Skip to content

I have files owned by root in my work directory

Olivier Berthonneau edited this page Jun 14, 2016 · 1 revision

By default, the user inside your docker containers is root. This means that the process in your container is run by root and thus any files created by this process will belong to root.

Unfortunately to avoid environment inconsistency, Docker does not synchronize users from the host environment with the container. This mean you can't just run the process in the container with you local user account.

There is no pretty solution to solve this yet. Either you can create a script that will chown you directories, or you can modify the Dockerfile to create a user with the same UID as you.

One solution is to assume you are developers with root access to your machine and that you can deal with permission access issues. Sorry.