Volumes
Part of the Introduction to Docker section of Coddy's Terminal journey — lesson 30 of 40.
When a container is removed, everything written inside it is lost. A volume is Docker-managed storage that lives outside any single container, so data survives even after the container is gone.
You create one with docker volume create and list volumes with docker volume ls:
docker volume create mydata
docker volume lsThe volume mydata now appears in the list. A container can mount this volume to keep its important files (a database's data, for example) safe across restarts and rebuilds.
Challenge
BeginnerCreate a volume named appdata, then list all volumes to confirm it exists.
Cheat sheet
Volumes persist data outside containers. Create and list with:
docker volume create mydata
docker volume lsTry it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.