-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I also found a fix, see most recent PR.
Describe the bug
Postgre docker compose creates a useless volume (random name like 998e1a214a2ab50ce098dc9bda4952e65e48b524f055ee5192fcafd7052b3f09) that can be pruned after container has started.
Data does not persist after docker compose down.
To Reproduce
Steps to reproduce the behavior:
With this compose.yml:
services:
postgres:
image: postgres:18-alpine
container_name: postgres-db
restart: unless-stopped
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: mydb
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data:
docker compose up
docker volume ls
DRIVER VOLUME NAME
local 998e1a214a2ab50ce098dc9bda4952e65e48b524f055ee5192fcafd7052b3f09
local a_postgres-data
Expected behavior
Only one volume is created and data is persistent.
docker compose up
docker volume ls
DRIVER VOLUME NAME
local a_postgres-data
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels