I have a problem with my database container, so I want to mount an existant database(from host) to the generated container (with docker-compose). I will show you the important part of the yaml file :
postgres:
image: postgres
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
ports:
- "5432:5432"
volumes:
- ./postgres/data:/var/lib/postgresql/data
So, when I build and turn on docker-compose, postgres container exited:
If I remove the persistant volume, it wokrs ! I have also tested with mysql, mongodb -> same issue.
Could you light me up ?
Thanks.

docker run -v data:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass --rm -it postgres bashFrom there you can try to start the postgres daemon just as if docker were not involved, and at that point your question becomes a postgres question (rather than a docker one).