Card 06/ 06

RecapDifficulty: Intermediate1 min

Recap: Running a Container

Five commands and one port rule, each with the card that covers it.

Running containers comes down to the five ideas below, each listed with the card that covers it.

What the topic established, and which card it was on
The ideaWhere
docker run pulls, creates and starts, and only the pull touches the networkdocker run: The Three Steps Behind One Command
-p 8080:80 forwards port 8080 on your machine to port 80 in the containerRunning nginx and Opening It in a Browser
-p is host first, container second; the container's number is set by the programPort Order in docker run -p
docker ps shows what is running, -a shows what exited, and docker logs says whyWhy a Container Exited: docker ps -a and docker logs
docker exec -it gets you inside a running container; docker run would start anotherOpening a Shell Inside a Running Container With docker exec

When something goes wrong, the order is always the same: find the container with docker ps -a, read what it said with docker logs, and look inside with docker exec only if the logs are not enough.