dokku: Dokku cannot work with user namespaces
Pushing to Dokku fails with following message:
$ git push dokku
Counting objects: 99, done.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (99/99), 22.41 KiB | 11.21 MiB/s, done.
Total 99 (delta 39), reused 99 (delta 39)
-----> Cleaning up...
-----> Building my-app from herokuish...
-----> Adding BUILD_ENV to build environment...
remote: chown: changing ownership of '/cache': Operation not permitted
To localhost:my-app
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@localhost:my-app'
When docker on the host uses user namespaces to increase isolation of containers and improve security.
Since /cache
is a mounted volume and Dokku attempt to run chown
on it fails:
remote: + local PHASE=BUILD
remote: + local FILE_PREFIX=DOCKER_OPTIONS_
remote: + local PHASE_FILE_PATH=/home/dokku/my-app/DOCKER_OPTIONS_BUILD
remote: + local output=
remote: + [[ -f /home/dokku/my-app/DOCKER_OPTIONS_BUILD ]]
remote: + echo -n ''
remote: + local 'DOCKER_ARGS= --env=USER=herokuishuser'
remote: + [[ -n 1 ]]
remote: + DOCKER_ARGS+=' -e TRACE=true '
remote: + declare -a ARG_ARRAY
remote: + eval 'ARG_ARRAY=( --env=USER=herokuishuser -e TRACE=true )'
remote: ++ ARG_ARRAY=(--env=USER=herokuishuser -e TRACE=true)
remote: ++ docker run --label=dokku -d -v /home/dokku/my-app/cache:/cache -e CACHE_PATH=/cache --env=USER=herokuishuser -e TRACE=true dokku/my-app:latest /build
remote: + cid=5af13e1a9ee6b1be0991f3f70fa40d6f9fbb1f398e0cd2e092498f8d6873506a
remote: + docker attach 5af13e1a9ee6b1be0991f3f70fa40d6f9fbb1f398e0cd2e092498f8d6873506a
remote: : Operation not permitted
remote: chown: changing ownership of '/cache/node/cache/node_modules/circular-json/LICENSE.txt': Operation not permitted
...(a lot more files ommitted)...
I’m not sure where it comes from but it clearly won’t work.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 24 (8 by maintainers)
Commits related to this issue
- feat: add support for custom user namespaces when creating persistent storage directories Closes #3454 — committed to dokku/dokku by josegonzalez 5 months ago
Hello! We have the same problem with docker + userns-remap + dokku. And, looks like, we have a workaround to fix it.
Information about enviroment
OS version:
Docker version:
Docker. daemon.json
Docker. User for userns-remap
Dokku version and user
Problem details
Dokku. Example postgres service creation
Docker container. Logs
Docker container. Volumes (inspect)
Dokku. Example postgres service destruction
Dokku. Example postgres service destruction with manual permissions fix
Dokku. Example postgres service creation with trace on
Service deployment:
Docker container:
Volume permissions fix. Docker container check. Example service destruction.
Workaround fix
Dokku user. uid/gid fix
Dokku folders. Permission fix
Dokku foldrers. Permissions check
Workaround fix check
Example dokku service creation
Volume permission check
Docker container and dokku service status check
Example dokku service destruction
Major points
disable-chown option can’t solve the issue (by our estimate), because dokku could create volume directories in some cases. Any application in a docker container doesn’t have permissions for use mounted volumes with or without disable-chown (if a volume has been created by dokku).
@jakubgs, maybe our workaround will be useful for you.
@josegonzalez, please could you check our workaround? Maybe you already have a dokku-way solution for docker + userns-remap + dokku. Or maybe our workaround isn’t goot and will cause problems in the future.
We would appreciate any information on the topic. Thanks.