Docker

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

Containers can't talk to each other
3
Test ping/DNS from inside a container
See the whole flow →

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store