DevOps Foundations · Module 5: Container basics · Lab
Fix Volume and Container Network Misconfigurations
45 min hands-on · Core
Local Docker/Podman with Compose; app plus database fixtures under /tmp/dlab-m05-02.
Two ways to do this lab: in your browser on Killercoda (free, no install), or on your own machine as a local guide. Killercoda runs one free scenario at a time: if you see a waiting queue, close other Killercoda tabs and wait a minute.
Objectives
- Diagnose data loss from missing volumes and isolation from wrong networks
- Fix with named volumes and a user-defined network
- Prove persistence across recreation and name-based connectivity
Step 1
Break state and network
Start the Compose pair with the database on the default network (or none) and its data in the container layer. Show the app failing to resolve the database by name.
Step 2
Fix both layers
Attach both services to a named network, move database data to a named volume, and remove published ports that only serve container-to-container traffic. Recreate both containers.
Step 3
Prove it survives
Write a row, recreate the database container, and read the row back. Show name resolution from inside the app container and the volume contents surviving.
How to confirm it worked
- Name-resolution failure quoted before the fix
- Named volume holds data across container recreation, shown by read-back
- App reaches database by name; no unnecessary published ports remain
- Compose file is the deliverable with the fix explained