Run a command in a container as another user
Runs the command inside the container as the given user, for example root to install a debugging tool.
docker exec -it -u root container shEdit the highlighted values, then copy. They are inserted as typed, without shell escaping.
Report an issue (opens in a new tab) wrong command, wrong danger level, typo… (on GitHub)
Adapted from tldr-pages (common/docker-container-exec.md), licensed under CC BY 4.0.