fixed failure if docker group already existed

This error prevents the container from restarting.
This commit is contained in:
kendokan 2018-01-11 08:13:11 -08:00 committed by GitHub
parent 40b8b93c2a
commit b52842b07a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,9 +23,11 @@ CRONTAB_FILE=/etc/crontabs/docker
mkdir -p ${HOME_DIR}/jobs ${HOME_DIR}/projects
# Create docker group using correct gid from host, and add docker user to it
DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCK})
addgroup -g ${DOCKER_GID} docker
adduser docker docker
if ! grep -q "^docker:" /etc/group; then
DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCK})
addgroup -g ${DOCKER_GID} docker
adduser docker docker
fi
slugify() {
echo "$@" | iconv -t ascii | sed -r s/[~\^]+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z