You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?
Docker commands
One page per command. What it does, when to use it, how risky it is.
Your laptop (D0 basics)
curlAsks an address for a page and prints the answer.Risk: SafechmodChanges who may read, write or run a file.Risk: SafeexportSets an environment variable for the programs you start here.Risk: SafepsLists processes: programs that are running now.Risk: SafeechoShows the exit code of the last command.Risk: Safe
Run containers
docker versionShows the Docker client and engine versions.Risk: Safedocker runMakes a new container from an image and starts it.Risk: Safedocker psLists running containers.Risk: Safedocker stopAsks a container to stop, then forces it after 10 seconds.Risk: Safedocker portShows which laptop ports lead into a container.Risk: Safe
Look inside
docker logsShows what a container printed.Risk: Safedocker execRuns a command inside a running container.Risk: Safedocker inspectShows everything Docker knows about a container, image, volume or network.Risk: Safedocker topLists the processes running in a container.Risk: Safedocker infoShows how the Docker engine is set up: runtimes, storage, cgroups and security.Risk: Safedocker diffLists the files a container added (A), changed (C) or deleted (D) on its top sheet.Risk: Safedocker cpCopies files between your laptop and a container.Risk: Careful
Images and recipes
docker imagesLists the images on your machine, with their size.Risk: Safedocker pullDownloads an image from a registry.Risk: Safedocker buildTurns a Dockerfile (the recipe) into an image.Risk: Safedocker historyShows the layers of an image and what made each one.Risk: Safedocker tagGives an image another name. Nothing is copied.Risk: Safedocker buildx buildBuilds one image for several CPU types (platforms) at once.Risk: Safe
Lockers and phone lines
docker volumeManages volumes: lockers that keep data after containers go.Risk: Carefuldocker networkManages networks: phone lines between containers.Risk: Safe
Set meals (Compose)
docker compose upStarts every service in compose.yaml.Risk: Safedocker compose downStops and removes the containers and network. Volumes stay.Risk: Carefuldocker compose psLooks at the services of this project.Risk: Safedocker compose watchUpdates containers as you save files.Risk: Safe
Share images
docker loginLogs in to a registry. Use an access token, not your password.Risk: Carefuldocker pushUploads an image to a registry.Risk: Carefuldocker scoutChecks an image's packages for known holes (CVEs). Needs a Docker login.Risk: Safedocker buildx imagetools inspectReads an image in a registry: its digest, platforms and attestations.Risk: Safe
Clean up
docker rmDeletes a stopped container and the files inside it.Risk: Can lose workdocker rmiRemoves an image name, and the image when no name is left.Risk: Carefuldocker system dfShows how much disk images, containers, volumes and cache use.Risk: Safedocker system pruneDeletes stopped containers, unused networks, dangling images and build cache.Risk: Can lose work