Topic
Docker
Package an app into a container image that is small, configurable and ready for an orchestrator.
Review this Topic 23 Review cards
About
This Topic covers Docker from the inside out: what an image, a container and a registry are, how to write a Dockerfile for a small Java service, and how to get the result ready for an orchestrator such as Kubernetes. Running other people's images is assumed; writing your own is where it starts.
After this Topic you can:
- Explain how an image, a container and a registry differ, and predict what survives a stop, a restart and a removal
- Write a multi-stage Dockerfile with a small runtime image, a non-root user and good use of the build cache
- Tag an image meaningfully, push it to a registry and pull it elsewhere
- Configure a container from outside with environment variables, ports and mounted files
- Make an app orchestrator-friendly: logs to stdout, clean shutdown on SIGTERM, a health endpoint, the right CPU architecture
- Run an app and its database with Compose, and map each piece to its Kubernetes counterpart
Lessons
- Images and Containers By the end, you can predict what happens to a file written inside a container when it is stopped, restarted or removed. Kubernetes will make that question very concrete for your app.
- Your First Dockerfile By the end, you will have built an image of your own Java service, run two copies of it, and know which Dockerfile lines run during the build and which run when a container starts.
- Smaller, Faster Builds By the end, your Java service will build with Maven inside Docker. A code change will rebuild without downloading anything, and the image you ship will have no compiler, no Maven and no source code in it.
Reference sheets
- Docker CLI Cheat Sheet Docker for Kubernetes · Reference
- Dockerfile Cheat Sheet Docker for Kubernetes · Reference
- Docker Glossary Docker for Kubernetes · Reference
Where this Topic fits
This Topic's Nodes and the Nodes one Relationship away in other Topics.
Loading the Graph…