Docker & Kubernetes · Module 05
Docker in Real Projects – Operations and Docker Compose
Keep containers running while the daemon is down, watch metrics and logs, then run multi-container apps with Docker Compose, environment variables and their own network.
What you will learn
- Enable live restore and choose a sound way to run several processes
- Read metrics with docker stats and configure logging drivers and log rotation
- Start, watch and tear down multi-container apps with docker compose
- Use .env, environment, project names and the default Compose network
Lessons
- Live restore and running several processes in a container
Live restore keeps containers running while the Docker daemon is down; each container should have one main service.
- Runtime metrics and logging
docker stats reads metrics from cgroups; docker logs reads stdout/stderr through a logging driver, so turn on log rotation.
- Introduction to Docker Compose
Declare every service of an app in one YAML file and manage its whole lifecycle with docker compose.
- Environment variables and networking in Compose
.env substitutes variables in the Compose file, environment/env_file put variables into containers; services reach each other by name on the default network.