Docker · Reference

Image & container commands

Printable cheat sheet for the first Docker loop: pull / run / list / stop / remove. Definitions match the course glossary once it exists.

Keep nearby

Core idea

ImageRead-only package
Reusable blueprint
ContainerRunning (or stopped) process
Created from an image

Run & inspect

# Create and start a container in the background
docker run --detach --name NAME --publish HOST:CONTAINER IMAGE

# List running containers
docker ps

# List all containers (including stopped)
docker ps --all

# List local images
docker image ls

Stop & clean up

# Graceful stop
docker stop NAME

# Remove a stopped container
docker rm NAME

# Stop + remove in one step
docker rm --force NAME

# Remove an image (only after no containers need it)
docker image rm IMAGE

Publish ports (preview)

# HOST:CONTAINER — your Mac first, app inside the container second
--publish 8080:80

Full port lesson comes later. For now: after --publish 8080:80, open http://localhost:8080.

Sources