Docker – Exec As Root

When shelling into a container isn’t root and you need it to be (i.e. you don’t have the root password and sudo isn’t set up), you can pass a uid number to the exec command and run the shell under root explicitly:

docker exec -u 0 -it ENGCurrentTest /bin/bash

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.