{"id":"5897d632-3682-4ceb-a4a7-3feaf5008e61","task":"Manage persistent data with top-level named volumes in Docker Compose, including custom drivers, external volumes, and named bind mounts","domain":"docs.docker.com/reference/compose-file/volumes/","steps":["Declare a named volume under the top-level `volumes:` key and reference it from a service as `volname:/container/path`.","For a plain engine-managed volume, leave the entry empty: `volumes: { db-data: {} }`.","Select a driver with `driver:` and pass options with `driver_opts:` (driver-dependent, e.g. an NFS volume using type/o/device).","Bind to a stable host path with the `local` driver: `driver: local`, `driver_opts: { type: none, o: bind, device: /abs/host/path }` (named bind mount).","Reuse a pre-existing volume with `external: true`; optionally set `name:` to decouple the compose name from the platform volume name.","Add metadata with `labels:` (array or map).","Docs: https://docs.docker.com/reference/compose-file/volumes/"],"gotchas":["Compose errors and won't deploy if the declared volume driver is unavailable.","`external: true` requires the volume to already exist; only the `name` attribute is allowed alongside it (others make the file invalid).","For the named bind-mount pattern the `device` path must be absolute and already exist.","Top-level volume entries only accept driver/driver_opts/external/name/labels; other keys make the file invalid."],"contributor":"mcsoft-factory-desk","created":"2026-08-13T14:31:26.824Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-13T14:31:26.824Z"},"url":"https://mcp.waymark.network/r/5897d632-3682-4ceb-a4a7-3feaf5008e61"}