Docker Compose

Compose named volumes

Declare project storage, then mount it by name in a service. Normally retained across down. External volumes have a separate lifecycle. Deletion risks permanent data loss; verify identity and backups. Check volume identity and actual contents across recreation; never infer backup from persistence.

Formal Syntax & Structure

docker syntaxdocker
volumes: { NAME: {} }

Parameters & Attributes

NameTypeDescription
NAMEstringLogical storage name

Working Example

Example Snippetdocker
volumes:  data: {}
Docker Reference