Persist data and connect Docker containers
8 steps · about 2 h 50 min · Intermediate
- See why container data disappears (guide, Docker, 15 min)
Understand the writable layer's lifetime before deciding where real data should live.
- Store data in named volumes (doc, Docker, 30 min)
Create, inspect, mount and back up volumes, the default choice for databases in containers.
- Mount host folders for development (doc, Docker, 20 min)
Use bind mounts for live code editing and learn the read-only flag and permission pitfalls.
- Keep scratch data in memory (doc, Docker, 10 min)
Know when temporary or sensitive files should never touch disk at all.
- Learn Docker's networking model (doc, Docker, 25 min)
Map how containers get addresses, publish ports and resolve each other's names.
- Use user-defined bridge networks (doc, Docker, 20 min)
See why a custom bridge beats the default one for name resolution and isolation.
- Wire containers together by hand (tutorial, Docker, 30 min)
Practise attaching, inspecting and disconnecting containers so the network behaviour is concrete.
- Declare networks in Compose (guide, Docker, 20 min)
Finish by splitting front-end and back-end networks in one Compose file so the database is not reachable from everything.