Docker compose "magic" user settings "unit:root" and "unit:test"

Hello,

probably really basic question, but I cannot find the answer. What the “magic” word “unit” means in the user directive inside of docker compose file? I see elements like user: “unit:root” or user: “unit:unit”. How should I interpret it?

The user setting overrides the user used to run the container process.
It accepts user and group names (username:groupname), or user and group ids (uid:gid).

There is no such thing as a magic word “unit”. it is just a username and a group name.

I know about meaning, but for example take a look at this file: netbox-docker/docker-compose.yml at release · netbox-community/netbox-docker · GitHub. There is no “unit” user in the system, but this docker-container works “out of the box”.

It must exist in the container. If it try to start the alpine image as “unit” user, I get this error message “Error response from daemon: unable to find user unit: no matching entries in passwd file”.

It is like I wrote earlier.

The users of the host system are irrelevant. The container has the “unit” user:

docker run -ti --rm --entrypoint sh docker.io/netboxcommunity/netbox -c 'grep unit /etc/passwd'

Is there a “unwritten convention” for naming user unit, because i saw it here and there?

There is not.

Let me put it this way: I use containers for 11 years now, and your post was the first time I read about the “unit” user (which really just is an arbitrary user name).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.