Docker Community Forums

Share and learn in the Docker community.

run docker container as a arbitrary user passed to it while running the image

I want to run a docker container as an arbitrary user which is passed to the image while running it. For example docker run -u 1000 myimage .

The above is possible. However I want to create a home directory with this user 1000 while starting the container(possibly through CMD) and do my container service stuff within that directory.

Is this possible and some pointers would be useful on ways to achieve it.


This is ofcourse possible, maybe create a custom startup script (entrypoint/cmd), but do you really need to?
why not just create a predefined folder, like, /app/ ?