0

I have my Dockerfile setup for dbt-snowflake/dbt-core with all its prerequisites. I also created a group for that docker image and added some users to that group while writing a docker file.

Incase, if some user want to get added to the image and run their own container, is it possible to do it? Instead of editing a dockerfile by adding a user and build it again.

I tried searching for "docker run [options]" command to pass the user name to the image while running up a container and it did not work for me.

Also tried to get commands for rebuilding the same image with adding a new user.

The command i use to run a container for the user already created while building an image.

docker run -itd -p portnumber:portnumber --user --mount --name

Can I use any command to create a user and add them to the existing group in that image?????

Kaviiiiii
  • 21
  • 2
  • You don't usually need to "create a user" _per se_, if you have a `docker run -u 12345` option then the main container process will run with that numeric user ID, and that's usually enough. – David Maze Nov 25 '22 at 12:04
  • If I want to run "docker run -u 12345" command, it says "user not found". Which means, the user needs to be created while writing a dockerfile. Am I right? – Kaviiiiii Nov 28 '22 at 08:45
  • What prints out that error? If you're bind-mounting a host directory into a container, it's pretty routine to `docker run -u $(id -u)` to run the container with the numeric user ID from the host, and the specific host uid normally won't be known at image-build time. – David Maze Nov 28 '22 at 11:12
  • @DavidMaze Can you please elaborate briefly. I'm little confused – Kaviiiiii Nov 30 '22 at 11:14

0 Answers0