docker exec
CautionExec inside container
docker exec -it <c> sh
Runs a command inside a running container; -it sh/bash for a shell.
Examples
docker exec -it db psql -U postgresOpen psql in the DB container
Syntax
docker exec -it <container> <cmd>
Before you run it
Changes inside a container aren't persistent; mind side effects.
Used when you see
Related commands
- docker psList containers
- docker logsContainer logs
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store