Replies: 2 comments
-
|
You should not have to use I verified with podman: the following options can be used:
With docker, I think the same thing can be achieved with |
Beta Was this translation helpful? Give feedback.
-
|
I've tested it, and I can confirm that it runs succesfully with podman, but I get the same error as the second issue when running with For completeness, the (succesfull) podman command I used is the following: and the (unsuccesfull) docker command I used is the following (this is being run by host-user-1000 and with docker rootless): (don't mind the unusual port and name, it was just to make it not collide with the already running instance) As I mentioned, the error for the docker run is the same as the second issue in the first post, that is issues with the permissions of the trash, but if needed I can provide the full log. Can I ask in practice what is the difference between using I'm not 100% sure that (Anyway, I can at least make it run as intended on podman, thank you for the help!) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've found that running this container with docker rootless (and possibly podman, though I haven't tested it) generates some weird behaviours and bugs which need
USER_ID=0(andGROUP_ID=0) to resolve.I want to document this issue so that possibly this fix gets mentioned in the documentation, hoping to save this headache to other users.
Note
There will be some confusion between the host user running docker, the user inside the container and the root-user inside the container. To try and avoid this confusion, I'll use the following notation:
1000on the host1000inside the containerNote that docker translates the container ids to host ids according to the rules in
/etc/subuid. In a typical case, since the host-user running docker has ID1000, then:0gets mapped to host-id-1000(and viceversa)1000gets mapped to host-id-100999(and viceversa)Setup to reproduce
The setup to reproduce the issues is the following:
Start with the following directory structure
where
./config/and./trash/empty directories owned by host-user (with permissions1000:1000) and the content of compose.yaml is the following:First issue
Let the host-user start the container (with docker rootless) with
you will notice that the permissions of the directory
./confighave changed from the original1000:1000to100999:100999. I believe this is because this container chowns the config directory to the container-user which has id specified by the environment variableUSER_ID(by default1000), which as discussed gets mapped outside of the container to the value100999.This isn't an issue on itself, as the container runs without a problem, but it becomes an issue when the host-user wants to backup the content of the
./configdirectorySecond issue
Uncomment the environment variable inside of
compose.yaml, with the following result:Now let the host-user (try to) run the container with
You will see that the container fails to start, giving the following error
This is because the
./trashdirectory, which has permissions1000:1000outside of the container, gets mounted with the mapped permissions of0:0inside the container and is owned by the container-root, so the container-user fails to use it. This causes the container to get stuck in a startup-loop and not start at all, which is of course problematic.Fix
Both of this issues are resolved with the following
compose.yaml:that is, by specifying
USER_ID=0andGROUP_ID=0in the container environment variables. This tells the container to run as container-root instead of container-host, and since container-root gets mapped to host-user, this results in the intended behaviour.Conclusion
I don't really think that this counts as a bug neither in docker-rootles nor in this container, because:
host-1000 <-> container-0andhost-100999 <-> container-1000is intended behaviourUSER_IDto be1000, because most people usually run docker not in rootless mode and by having this default, it makes it easy to have the correct permissions in and out of the containerI do think though that this was a bit of a headache to figure out, and it might be useful to other user to add a small note under the chapter
User/Group IDsof the README along the lines of:Note: I keep mentioning podman because as far as I can tell, it behaves similarly to docker rootless and I guess it would result in the same bug, though I haven't tested it. If someone wants to test it I'd be interested in the results they get!
Beta Was this translation helpful? Give feedback.
All reactions