Chapter 07
Monitoring, security and maintenance
Observe containers
Inspect logs, health, resource usage and restart policy. A running process does not automatically mean the application is healthy.
docker stats --no-stream
docker ps -a
docker events --since 5mHands-on lab: Identify a stopped container and its exit code.
Harden workloads
Run as non-root where practical; use minimal trusted base images, explicit resource limits, read-only filesystems where possible, vulnerability scanning and least-privilege permissions.
docker run --rm --read-only --cap-drop ALL alpine idHands-on lab: Explain why mounting the Docker socket inside a container is sensitive.
Recovery and backups
Document rebuild procedures, store Dockerfiles and Compose files in Git, keep data backups separate from images and regularly test restores.
docker system df
docker image pruneHands-on lab: Review what can be safely pruned on a training host.