Docker Volume
Question
What is a Docker volume?
Hint
Volumes persist data beyond container lifecycle.
Explanation
A Docker volume is a persistent storage mechanism that survives container removal. Containers are ephemeral — data in the container filesystem is lost when removed. Volumes store data on the host filesystem, managed by Docker. Types: named volumes (docker volume create myvol), anonymous volumes (auto-created), bind mounts (mount host directory). Use volumes for databases, file uploads, logs. Commands: docker volume ls, rm, inspect. In docker-compose.yml, define volumes under the volumes key. Volumes can be shared between containers.
Related Resources
Related Lessons
- Docker Containers
Learn containers.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.