Data That Survives
Move container data onto a named volume so redeploys can't destroy it.
A intermediate Docker challenge worth 10 points. Solve it hands-on in a real Docker environment in your browser - no local setup, no fake shells.
The Challenge
Scenario: Last week's redeploy of the notes service wiped all user data — it lived in the container's writable layer.
Tasks:
- Create a named volume
notes-data - Recreate
notes(imagealpine, commandsleep infinity) with the volume mounted at/data - Write a file
/data/notes.txtcontainingmeeting at 5 - Bonus:
docker rm -f notes, recreate it with the same volume — your file is still there
Commands to learn: docker volume create, docker run -v, docker inspect (Mounts)
Run check when done.