-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile: Explictly create volume paths and set permissions #909
Conversation
This allows running the docker image with a non-root user (--user 2000) with named/anonymous volumes (-v isso-db:/db). When an empty volume is mounted into a container (non-bind mount), it is prepopulated with the files at the mount path, including owners and permissions. The issue is that since /db does not exist at docker build time, the volume defaults to root ownership with 0755 permissions, which prevents non-root users from creating the sqlite database. This change explicitly creates the /config and /db directories with 1777 permissions to allow any user to write to them. Note that this has no impact on bind mounts, since these always use permissions of the host filesystem.
I think setting the permissions to 777 is a bit much. I know there's other images I've used that work fine when using a non-root container, maybe we'll have to figure out how they work |
Thanks for the feedback @BBaoVanC! I chose the I'll also note that the sticky bit (the |
Ah that makes more sense then. I guess this is fine, since the |
@mbrase if you don't currently have enough free time to overhaul the whole Dockerfile, I'm fine with merging this as-is. |
I apologize for the delayed response, I've been traveling lately. I am not much of a docker expert myself, and am a bit intimidated with overhauling the entire Dockerfile. I'd prefer to just merge this before it gets stale. |
Thanks, no worries. |
Checklist
CHANGES.rst
because this is a user-facing change or an important bugfixWhat changes does this Pull Request introduce?
This change explicitly creates the volume mount directories in the docker image and gives them global write permissions (
1777
).Why is this necessary?
This allows the docker images to be use named/anonymous volumes (e.g
-v /db
or-v isso-db:/db
) with non-root users (e.g.--user=2000:2000
).For example:
The reason that this change fixes the issue is that empty docker named/anonymous volumes are prepopulated with the container contents at the mount path, including owners and permissions. Since
/db
does not exist a volume mounted there will use default owner ofroot:root
and permissions0755
, which is not writeable by a non-root user.Note that this does not change the behavior of bind mounts, which always retain the permissions of the host filesystem.