The notes service runs in a container: busybox serves files from the /data directory over HTTP, and the notes are in /data/notes.txt. To change a setting, the container is re-created — removed and started again from the same notes:1 image, as in the previous module.
Look at the notes, re-create the container and look into /data again. “Start” will launch docker and the service.
Re-create the container with the notes
Print the notes from the notes container, remove the container, create it again from the notes:1 image and look at what is in /data.
First, predict
The new container is created from the same notes:1 image. What will ls -A /data show in it?
Now start the exercise, run the command and compare your prediction with the output.
Where were the notes before docker rm?
-
catread the notes from the /data/notes.txt file on the container's disk. The file itself is gone:ls -A /datais empty. -
The old container is gone:
docker ps -ashowed one notes, the new one, with theUpstatus. -
The new container from the same notes:1 started with an empty /data: the image holds no notes.
The notes were in the container's own files, and docker rm removed them together with it.