Docker Commands to Remember
This article is a list of some Docker commands you should keep in mind.
1. docker exec
docker exec
- Description: execute a command in a running container
- Usage:
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Description
The docker exec command runs a new command in a running container.
Options
-d,--detach: detached mode (run command in the background)-i,--interactive: keep STDIN open even if not attached-t,--tty: allocate a pseudo-TTY-u,--user: username or UID
Examples
- Execute an interactive
shshell inside mycontainer :docker exec -it mycontainer sh - Execute an interactive
shshell inside mycontainer with the root user:docker exec -it --user root mycontainer sh
No comments to display
No comments to display