1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [volumes (compose)](<https://delaparra-services.nl/knowledge-hub/volumes-compose>)

  

Category: Docker 

# volumes (compose)

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is volumes (compose)?

 

volumes (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.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about volumes (compose)

  

### What should you keep in mind with volumes (compose)?

 

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.

    

### What does an example of volumes (compose) look like?

 

```
services: db: volumes: - db-data:/var/lib/postgresql/data volumes: db-data: {}
```

 

## At a glance

   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Docker terms

 

- [tag](<https://delaparra-services.nl/knowledge-hub/tag>) 
- [tag-and-push](<https://delaparra-services.nl/knowledge-hub/tag-and-push>) 
- [tmpfs](<https://delaparra-services.nl/knowledge-hub/tmpfs>) 
- [USER](<https://delaparra-services.nl/knowledge-hub/user>) 
- [VOLUME](<https://delaparra-services.nl/knowledge-hub/volume>) 
- [WORKDIR](<https://delaparra-services.nl/knowledge-hub/workdir>)

 

[All terms starting with V](<https://delaparra-services.nl/knowledge-hub#letter-v>)

 

## Skills

 

- ### Docker Compose Patterns

 

Use 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.

 [View skill](<https://delaparra-services.nl/skills/docker-compose-patterns>) [Download zip](<https://delaparra-services.nl/skills/docker-compose-patterns/download>) 
- ### Docker Destructive Command Guardrails

 

Use 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\`,

 [View skill](<https://delaparra-services.nl/skills/docker-destructive-guardrails>) [Download zip](<https://delaparra-services.nl/skills/docker-destructive-guardrails/download>) 
- ### Docker Project Foundations

 

Use 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.

 [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/volumes-compose/skills.zip>)

 

## Manuals

 

- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck 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.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/volumes-compose)
