Hacker symbol

July 23, 2021 ~ 1 min read

Docker User in Containers


https://docs.docker.com/engine/reference/run/#user

Those users are accessible by name. When passing a numeric ID, the user does not have to exist in the container.

So basically, if you pass:

docker run -u myuser:myuser busbox

The user myuser doesn't exist in the docker container so it has to be created inside the docker container.

But if you instead pass the uid and gid the username only has to exist in the host system.

docker run -u 1000:1000 busbox

Sebastian BolaƱos

Hi, I'm Sebastian. I'm a software developer from Costa Rica. You can follow me on Twitter. I enjoy working on distributed systems.