Shared server guidance · Question & answer

How do I identify where a Docker container stores persistent data?

Container files may be stored in the writable container layer, a named volume, a bind mount or another mount type. These have different lifecycles. Inspect the exact application mount mapping before replacing a container, moving a host or planning recovery.

IntermediateDocker Engine containers on Linux
Go to the answer

Before you start

  • Authorised Docker access and the exact container name.
  • Knowledge of which application directories contain durable data.

Instructions

1. Inspect only the mount fields

A focused format avoids printing the container’s environment, where passwords may be stored. Compare each destination with the application’s documented data directories.

Remote Linux shell
docker inspect --format '{{range .Mounts}}{{println .Type .Source .Destination}}{{end}}' app

Lists mount type, source and in-container destination for the selected container.

2. Inspect a named volume when present

Use the actual volume name from the deployment. A volume driver may manage storage differently from an ordinary local directory.

Remote Linux shell
docker volume inspect --format 'name={{.Name}} driver={{.Driver}}' app-data

Shows selected metadata for the example named volume without reading its contents.

3. Check the application’s persistence design

If important files are outside the intended mounts, they may disappear when the writable layer is replaced. Confirm database consistency, permissions and recovery procedures before moving data. A mounted volume is persistent storage, not an independent backup.

Check the result

  • Every durable application data path maps to an intentional storage location with an understood lifecycle.

Troubleshooting

The data directory is absent from Mounts
Confirm whether the application writes into its container layer. Plan a tested migration to the intended persistent storage; do not delete or recreate the container before preserving required data.
A bind mount source differs between hosts
Validate the host path and contents on the destination; the same Compose file path string does not ensure the same underlying data.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.