Specify docker exec user
2019-09-03
With docker exec
, you can execute commands inside of running Docker containers.
The --user
flag allows you to declare the user to use inside the container.
Example:
$ docker run -d
cf4bea1aa03eafc0a4adf49cc1f38e98de66ab586cbf026d369de2d51f83fbc3
$ docker exec -it --user postgres cf4bea1a /bin/bash
postgres@cf4bea1aa03e:/$