How do you list volumes in docker containers?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Listing Docker volumes can mean two different things: showing all named volumes on the host or showing which mounts a specific container is using. Docker has commands for both, and knowing the difference matters because a container may use named volumes, bind mounts, or temporary filesystems.
List All Named Volumes on the Host
If you want to see every named volume Docker knows about, use docker volume ls.
Typical output looks like this:
This command is host-level. It does not tell you which running container uses each volume, only that the volumes exist in Docker's local volume store.
To inspect one of those volumes in more detail:
That shows metadata such as the mountpoint on disk, driver, and labels.
List the Volumes Used by a Specific Container
If the question is really "what is mounted into this container," inspect the container rather than the volume list.
The raw output is large, so it is usually better to extract only the mount information:
Example output:
This tells you:
- the mount type
- the host-side source path
- the container destination path
- the named volume, when one is involved
That is the most direct answer when you are debugging persistent data inside a single container.
Understand the Difference Between Volume Types
Docker mounts are not all the same. A container can use:
- a named volume managed by Docker
- a bind mount that points to a host directory
- a
tmpfsmount stored in memory
That distinction matters because docker volume ls only shows named volumes. If your Compose file mounts ./data:/app/data, that is a bind mount, not a Docker volume, so it will not appear in the volume list.
For example:
In that example:
- '
./site:/usr/share/nginx/html:rois a bind mount' - '
app_cache:/var/cache/appis a named volume'
The bind mount appears in .Mounts during docker inspect, but not in docker volume ls.
Use Compose-Aware Checks When Needed
If you are working in a Compose project, first find the real container name:
Then inspect the container:
This shorter view is handy when you only care about the source and destination mapping. It makes it obvious whether the data is coming from a host path or from a named Docker volume.
You can combine this with docker volume inspect on any named volume you discover to trace the storage path all the way back to the host filesystem.
Practical Debugging Workflow
When volume-related issues appear, use a fixed sequence:
- Run
docker compose psordocker psto identify the container - Run
docker inspect --format='{{json .Mounts}}' ... - Check whether each mount is a bind mount or named volume
- If it is a named volume, run
docker volume inspect
That sequence removes ambiguity quickly. It also helps when a team says "the volume is missing" but the real issue is that the service is using a bind mount from the wrong directory.
Common Pitfalls
- Using
docker volume lsto debug bind mounts does not work because bind mounts are not named volumes. - Inspecting the wrong container is common in Compose projects where container names are generated. Check
docker compose psfirst. - Assuming a listed volume is attached to the current container is incorrect. A volume can exist on the host without being mounted into the container you care about.
- Reading the full
docker inspectoutput manually is slow and error-prone. Filter to.Mountsso the relevant data is obvious. - Confusing the host source path with the container destination path can lead to deleting or editing the wrong data location.
Summary
- Use
docker volume lsto list named volumes on the host. - Use
docker inspect --format='{{json .Mounts}}' containerto see what a specific container mounts. - Distinguish named volumes from bind mounts before diagnosing storage issues.
- In Compose projects, identify the generated container name first with
docker compose ps. - Follow the inspect sequence consistently to find where persistent data is really stored.
Related reading
- How do you perform Django database migrations when using Docker-Compose?
- How does docker image size impact runtime characteristics?
- How does Kubernetes' scheduler work?
- How does one detect if one is running within a docker container within Python?
- How do you log the machine name via log4net?
- How do you manage databases in development, test, and production?
- How does one remove a Docker image?
- How does one remove a Docker image?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.