Using a bind mount rather than a container volume for psql

Is it possible to define a bind mount in the docker-compose.yml in which the postgres container can store the database rather than using the default volume configuration?

Of course you can try it out. That’s how open source work. Change something, try it out and keep experimenting.

The only thing you need to consider with a bind mount is the permission and user mappings to your host. Sometimes they get broken by docker in some strange way and therefore the container can’t access the data anymore. Happened to me several times in the past when putting the unix sockets into a bind mount.

Let us know if it works reliable at the end.


A more experienced technician found a different way to proceed. Stability was never an issue - it never successfully started the container for me. Thanks for the reply.