Skip to content

Commit

Permalink
create docker group only if group with GID does not exist
Browse files Browse the repository at this point in the history
Refer #5
  • Loading branch information
Sameer Naik committed Oct 5, 2015
1 parent 8485600 commit 00f613c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ update_ca_certificates() {

grant_access_to_docker_socket() {
if [ -S /run/docker.sock ]; then
groupadd -g $(stat -c %g /run/docker.sock) docker
usermod -a -G docker ${GITLAB_CI_MULTI_RUNNER_USER}
DOCKER_SOCKET_GID=$(stat -c %g /run/docker.sock)
DOCKER_SOCKET_GROUP=$(stat -c %G /run/docker.sock)
if [[ ${DOCKER_SOCKET_GROUP} == "UNKNOWN" ]]; then
DOCKER_SOCKET_GROUP=docker
groupadd -g ${DOCKER_SOCKET_GID} ${DOCKER_SOCKET_GROUP}
fi
usermod -a -G ${DOCKER_SOCKET_GROUP} ${GITLAB_CI_MULTI_RUNNER_USER}
fi
}

Expand Down

0 comments on commit 00f613c

Please sign in to comment.