Docker volume mount inspection cheat sheet
Trace a container mount to its Docker volume and inspect its driver and attachment.
Docker Engine CLI with read access to the intended daemon; bind mounts and volumes are distinct mount types.
Updated · Docker · 6 min read
| Command | What it does |
|---|---|
docker context show | Confirm the Docker context |
docker volume ls | List volumes on the daemon |
docker volume inspect app-data | Inspect the selected volume |
docker inspect --format "{{json .Mounts}}" web | Inspect container mount attachments |
docker ps -a --filter volume=app-data | List containers referencing the volume |
Walkthrough
Confirm the Docker context and replace web and app-data with the actual container and volume. Inspect output can contain internal paths and configuration; these commands do not remove data.
Step 1: Confirm the Docker context
docker context show
Compare the active context with the incident environment. A similarly named volume can exist on another daemon; check for endpoint overrides before interpreting results.
Step 2: List volumes on the daemon
docker volume ls
Find the exact volume name and driver. Listing a volume does not prove that a particular container uses it or that its application data is current.
Step 3: Inspect the selected volume
docker volume inspect app-data
Record the exact name, driver, scope and mountpoint. Driver behavior varies, and the daemon host mountpoint is not necessarily a path on a Docker Desktop client.
Step 4: Inspect container mount attachments
docker inspect --format "{{json .Mounts}}" web
Compare mount type, source or volume name, destination and read-write state. Bind mounts use host paths while Docker-managed volumes are identified by volume names.
Step 5: List containers referencing the volume
docker ps -a --filter volume=app-data
Compare container IDs and names with the expected workload. A reference does not establish that a service is healthy or that the application is writing to the expected path.
WORKED INCIDENT
Practical case: Application data looks empty after recreation
Fictional teaching scenario; observations are examples, not captured production output.
Situation
A newly recreated container starts, but the application displays no previous data.
Investigation sequence
1. Confirm the Docker context
docker context showConfirm the CLI targets the intended Docker daemon.
2. List volumes on the daemon
docker volume lsIdentify the exact volume name expected for the application.
3. Inspect container mount attachments
docker inspect --format "{{json .Mounts}}" webCompare the recreated container mount destination and volume name with the expected configuration.
4. List containers referencing the volume
docker ps -a --filter volume=app-dataCheck which containers reference the original named volume.
Example findings
Illustrative findings: the old container references app-data, while the replacement mounts a differently named volume.
Interpret the findings
The mount mismatch explains why the replacement sees a different data location in this example. Do not delete either volume; verify the authoritative data and deployment configuration first.
Verify the outcome
After the owner corrects the approved deployment, verify the mount and application data through its normal read path and backup procedures.
Escalation handoff
Provide daemon context, container IDs, volume names and mount destinations to the application owner without sharing data contents.
Primary references
Documented reference; examples above are teaching scenarios. Confirm behavior against your deployed version.