DEV Community


Posted on

PostgreSQL Docker Compose with Persistent Volume

To use Docker Compose to set up a PostgreSQL database with a persistent volume, you can define a services block in your docker-compose.yml file that specifies the configuration for your PostgreSQL service. This block should include the image for the PostgreSQL service, as well as any configuration options and environment variables that you want to set.

For example, the following docker-compose.yml file sets up a PostgreSQL service using the official PostgreSQL image, and specifies that the data files for the database should be stored in a persistent volume named “postgres-data”:

read full:

Top comments (0)