girder / girder_worker

Distributed task execution engine with Girder integration, developed by Kitware
http://girder-worker.readthedocs.io/
Apache License 2.0
34 stars 30 forks source link

Docker in docker permission issue #331

Open schorlton opened 5 years ago

schorlton commented 5 years ago

When using the girder_worker docker image, unable to run docker from within the worker container due to permission issue. Specifically the docker group does not appear to be created and worker user added to the group.

Docker executable and socket were mounted into the girder_worker container as previously described: https://github.com/girder/girder_worker/issues/89

-v  /tmp:/tmp
-v  /var/run/docker.sock:/var/run/docker.sock
-v  /usr/bin/docker:/usr/bin/docker

Error when trying to run docker from within the container:

worker@af4c874402be:/$ docker images
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json: dial unix /var/run/docker.sock: connect: permission denied
manthey commented 5 years ago

In the girder_worker docker, if the docker group has a different group id than the docker group of the host system, then there can be issues. In another project (https://github.com/DigitalSlideArchive/HistomicsTK), when creating a girder_worker docker, we explicitly change the uid and gid inside the girder_worker docker to match that of the host system, and the chown files to ensure that they have the right ownership.