Accessing Docker Container As Root

On occasion you might need to access your docker container as root. Using docker exec you can do that fairly easily:

docker exec -u 0 -it mycontainer bash

From the docs it states: root (id = 0) is the default user within a container. The image developer can create additional users. Those users are accessible by name. When passing a numeric ID, the user does not have to exist in the container.

Read more about it here

Instagram Post