Skip to content

Instantly share code, notes, and snippets.

@Klerith
Created June 16, 2023 19:29
Show Gist options
  • Save Klerith/1a6a78e4cd4e86368d679bcfc55d9ec7 to your computer and use it in GitHub Desktop.
Save Klerith/1a6a78e4cd4e86368d679bcfc55d9ec7 to your computer and use it in GitHub Desktop.
Postgres - Docker compose
version: '3'
services:
todosDB:
image: postgres:15.3
container_name: todos-db
restart: always
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- ./postgres:/var/lib/postgresql/data
@alexandergonzalezsaavedra

Buen día,
tenia el mismo inconveniente y lo solucione cambiando el archivo docker-compose.yml por:

version: '3.8'

services:
todosDB:
image: postgres:15.3
container_name: todos-db
restart: always
ports:
- '5432:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres-data:/var/lib/postgresql/data

volumes:
postgres-data:
driver: local

y en la terminal ejecute:

docker-compose down -v

docker volume rm /ruta...

docker-compose up -d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment