1

I'm running the ubuntu docker image from my mac. When I do docker run -it containername it starts as root. But I want to start as a user instead, I don't want to have to manually do login username

Dave
  • 125
  • https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo/477554#477554 – Rinzwind Jun 16 '19 at 14:03
  • @Rinzwind I'm not trying to run docker without sudo, I'm trying to launch my ubuntu container and be logged in as a user, instead of as root – Dave Jun 16 '19 at 14:13

1 Answers1

2

Run it as: docker run --interactive --tty --user $(id -u):$(id -g) containername.

You should have a user already created in dockerfile with same uid/guid.

The already posted link refers to docker daemon which is another matter.