{
    "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose",
    "locale": "en",
    "title": "volumes (compose): Knowledge hub | DeLaParra Services",
    "description": "Declares named volumes and mounts them into services for persistent data that outlives container restarts.",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/volumes-compose",
        "nl": "https://delaparra-services.nl/nl/kennisbank/volumes-compose"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/volumes-compose.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/volumes-compose.md",
        "json": "https://delaparra-services.nl/knowledge-hub/volumes-compose.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/volumes-compose.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/volumes-compose.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose.csv",
            "encodingFormat": "text/csv",
            "name": "volumes-compose.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose.json",
            "encodingFormat": "application/json",
            "name": "volumes-compose.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose.md",
            "encodingFormat": "text/markdown",
            "name": "volumes-compose.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose.pdf",
            "encodingFormat": "application/pdf",
            "name": "volumes-compose.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose.zip",
            "encodingFormat": "application/zip",
            "name": "volumes-compose.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose/skills.zip",
            "encodingFormat": "application/zip",
            "name": "volumes-compose-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [volumes (compose)](<https://delaparra-services.nl/knowledge-hub/volumes-compose>)\n\n  \n\nCategory: Docker \n\n# volumes (compose)\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is volumes (compose)?\n\n \n\nvolumes (compose): Declares named volumes and mounts them into services for persistent data that outlives container restarts. In Docker Compose, the top-level ` volumes ` section declares named volumes, and services mount them, as in ` db-data:/var/lib/postgresql/data `. Named volumes keep data when containers are stopped, removed or recreated. That is essential for databases in development. Without a volume, ` docker compose down ` and ` up ` would give you an empty database every time.\n\n \n\nDefinition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)\n\n \n\n## Frequently asked questions about volumes (compose)\n\n  \n\n### What should you keep in mind with volumes (compose)?\n\n \n\nNamed volumes are managed by Docker and listed with ` docker volume ls `. ` docker compose down -v ` removes them together with the containers, which is handy for a clean start and dangerous when you did not mean it. For code, use bind mounts to your project folder instead, so edits appear immediately. Back up important volumes, for example with a database dump, because they live only on that one machine.\n\n    \n\n### What does an example of volumes (compose) look like?\n\n \n\n```\nservices: db: volumes: - db-data:/var/lib/postgresql/data volumes: db-data: {}\n```\n\n \n\n## At a glance\n\n   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026\n\n \n\n## More Docker terms\n\n \n\n- [tag](<https://delaparra-services.nl/knowledge-hub/tag>) \n- [tag-and-push](<https://delaparra-services.nl/knowledge-hub/tag-and-push>) \n- [tmpfs](<https://delaparra-services.nl/knowledge-hub/tmpfs>) \n- [USER](<https://delaparra-services.nl/knowledge-hub/user>) \n- [VOLUME](<https://delaparra-services.nl/knowledge-hub/volume>) \n- [WORKDIR](<https://delaparra-services.nl/knowledge-hub/workdir>)\n\n \n\n[All terms starting with V](<https://delaparra-services.nl/knowledge-hub#letter-v>)\n\n \n\n## Skills\n\n \n\n- ### Docker Compose Patterns\n\n \n\nUse this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.\n\n [View skill](<https://delaparra-services.nl/skills/docker-compose-patterns>) [Download zip](<https://delaparra-services.nl/skills/docker-compose-patterns/download>) \n- ### Docker Destructive Command Guardrails\n\n \n\nUse this skill before running, or recommending, any Docker command that deletes, wipes, resets, or otherwise irreversibly changes state — even if the user just says to \"clean up\", \"clear the cache\", \"start fresh\", \"wipe everything\", \"nuke it\", \"reset\", \"force remove\", or \"tear down\" Docker resources. Covers generic Docker CLI destructive operations not owned by a more specific skill — \\`docker rm\\`,\n\n [View skill](<https://delaparra-services.nl/skills/docker-destructive-guardrails>) [Download zip](<https://delaparra-services.nl/skills/docker-destructive-guardrails/download>) \n- ### Docker Project Foundations\n\n \n\nUse this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.\n\n [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>)\n\n [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/volumes-compose/skills.zip>)\n\n \n\n## Manuals\n\n \n\n- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>)\n\n \n\n## Related services\n\n \n\n- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)\n\nPerhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.\n\n \n\n## Need any help?\n\n \n\nStuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.\n\n  [Get in touch](<https://delaparra-services.nl/availability>)\n\n[HTML version](https://delaparra-services.nl/knowledge-hub/volumes-compose)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "FAQPage",
                "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose",
                "name": "volumes (compose): Knowledge hub | DeLaParra Services",
                "description": "Declares named volumes and mounts them into services for persistent data that outlives container restarts.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#term",
                    "name": "volumes (compose)",
                    "description": "Declares named volumes and mounts them into services for persistent data that outlives container restarts.",
                    "termCode": "volumes-compose",
                    "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose",
                    "inLanguage": "en",
                    "keywords": "Docker",
                    "dateModified": "2026-11-25T17:46:31+00:00",
                    "inDefinedTermSet": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#terms"
                    },
                    "isPartOf": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#dataset"
                    },
                    "subjectOf": [
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is volumes (compose)?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Declares named volumes and mounts them into services for persistent data that outlives container restarts. In Docker Compose, the top-level volumes section declares named volumes, and services mount them, as in db-data:/var/lib/postgresql/data. Named volumes keep data when containers are stopped, removed or recreated. That is essential for databases in development. Without a volume, docker compose down and up would give you an empty database every time."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with volumes (compose)?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Named volumes are managed by Docker and listed with docker volume ls. docker compose down -v removes them together with the containers, which is handy for a clean start and dangerous when you did not mean it. For code, use bind mounts to your project folder instead, so edits appear immediately. Back up important volumes, for example with a database dump, because they live only on that one machine."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What does an example of volumes (compose) look like?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "services: db: volumes: - db-data:/var/lib/postgresql/data volumes: db-data: {}"
                        }
                    }
                ],
                "author": {
                    "@id": "https://delaparra-services.nl/#person"
                },
                "mentions": [
                    {
                        "@id": "https://delaparra-services.nl/skills/docker-compose-patterns#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/docker-destructive-guardrails#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/docker-project-foundations#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/docker-voor-je-laravel-app#article"
                    }
                ]
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Knowledge hub",
                        "item": "https://delaparra-services.nl/knowledge-hub"
                    },
                    {
                        "@type": "ListItem",
                        "position": 3,
                        "name": "volumes (compose)"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#dataset",
                "name": "volumes (compose)",
                "description": "Declares named volumes and mounts them into services for persistent data that outlives container restarts.",
                "url": "https://delaparra-services.nl/knowledge-hub/volumes-compose",
                "identifier": "https://delaparra-services.nl/knowledge-hub/volumes-compose#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/volumes-compose#term"
                },
                "creator": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://creativecommons.org/licenses/by/4.0/",
                "creditText": "Coders Lingo (https://coderslingo.com/resources/open-dataset/), CC BY 4.0",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "keywords": "Docker",
                "version": "2026-11-25",
                "dateModified": "2026-11-25T17:46:31+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#dataset",
                    "name": "IT terms from A to Z",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "volumes-compose-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/volumes-compose/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}