Skip to content

Why data in a volume survives docker rm

Select an icon to see what it is.

Step 4 of 6

A new container sees the old data

A new container that mounts appdata at /data gets the same directory. It sees a.txt, and it does not see b.txt. That is how a replaced database container keeps its data.

$ docker run --rm -v appdata:/data alpine ls /data

Contents of /data in the new container

a.txt