I have the following docker-compose part
postgres:
container_name: postgres
image: postgres
environment:
POSTGRES_PASSWORD: "postgres"
ports:
- "15432:5432"
volumes:
- /root/database:/var/lib/postgresql/data
networks:
- production-network
restart: unless-stopped
depends_on:
- rest-proxy
- broker
What should I do to run a .sql file and restore the db as soon as I run docker-compose ?
.sqlfile and what do you mean by restoring the DB?/docker-entrypoint-initdb.dwhen the container is first created; also see How to create User/Database in script for Docker Postgres. More generally, Backup/Restore a dockerized PostgreSQL database discusses this topic.