Is root
the default user when calling docker exec
(without --user
)?
Does a USER
line in the Dockerfile affect the default user for docker exec
?
The default user in docker exec is the same user used to start the container which can be set in docker run or your compose file.
If you do not explicitly set the user when starting the container, it will default to the user configured in the image, you can inspect the image to look this up. This is configured by the last USER line in the Dockerfile. It may also be configured by a parent image specified by the FROM line.
If neither the image, nor the run command specifies a user, docker defaults to root
, uid 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With