Automation · Container Automation
Docker CLI
Cheat sheet · https://pcornel.dk/topic.php?topic=5782
Answer
The Docker CLI (docker build, run, ps, logs, exec, push) is the command-line way to manage images and containers, easy to script but best combined with Compose or IaC for repeatable setups.
Remember
- The Docker CLI is easy to script but not declarative.
- Check exit codes of each command.
- Move repeated setups to Compose or IaC.
First checks
docker ps -a --format '{{.Names}} {{.Status}}'— containersdocker inspect <c> --format '{{.State.Health.Status}}'— healthdocker logs --tail 50 <c>— logs
Commands
docker run --rmdocker run
Verify in this order
script → docker CLI → daemon → containers
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5782