Linux Labs

Containers: Docker and compose / Stage 5 of 11

Volumes: data outlives the container

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 7 · lab · 20 minmedium

Data after re-creation

After the notes application was updated, the list is empty although the container is running. Find the notes and give them back to the application without losing any.

Situation

The on-call shift keeps its notes in the notes application. It runs in a Docker container of the same name and lists the notes since the start of the month on port 8080. Last night a colleague updated the application to version 1.1: they removed the container and created a new one from the notes:1.1 image with the same port, NOTES_TITLE variable and restart policy. The container is running, but this morning curl http://localhost:8080/ shows notes: 0.

Run docker commands with sudo: the student user has no direct access to Docker. The machine has no internet access; the notes:1.0 and notes:1.1 images are already built.

Task

  1. http://localhost:8080/ answers with version 1.1 of the application and shows all the notes that existed before the update.
  2. The notes container keeps the notes where they were before the update and has no extra volumes.
  3. The earlier notes are unchanged.
  4. notes runs with the same port, NOTES_TITLE and restart policy as before: it will come up by itself after the machine reboots.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • http://localhost:8080/ answers with notes 1.1 and shows all the notes that existed before the update — not done yet
  • The notes container keeps the notes where they were before the update and has no extra volumes — not done yet
  • The earlier notes are unchanged — their checksums match — not done yet
  • notes runs with the same port, NOTES_TITLE and restart policy as before — it will come up by itself after a reboot — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • http://localhost:8080/ answers with notes 1.1 and shows all the notes that existed before the update — not done yet
  • The notes container keeps the notes where they were before the update and has no extra volumes — not done yet
  • The earlier notes are unchanged — their checksums match — not done yet
  • notes runs with the same port, NOTES_TITLE and restart policy as before — it will come up by itself after a reboot — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • http://localhost:8080/ answers with notes 1.1 and shows all the notes that existed before the update — not done yet
  • The notes container keeps the notes where they were before the update and has no extra volumes — not done yet
  • The earlier notes are unchanged — their checksums match — not done yet
  • notes runs with the same port, NOTES_TITLE and restart policy as before — it will come up by itself after a reboot — not done yet
Loading…