Docker, PostgreSQL, Software Development

docker-compose.yml for PostgreSQL

This post provides a basic docker-compose.yml to create a PostgreSQL container with an initial user account with a password.

Tested with:

  1. Docker for Windows
  2. PostgreSQL 12
  3. Windows 10

A YAML File

A docker-compose.yml is just a text file. The YAML below can be used to create and run a Docker container that has a PostgreSQL in it with a valid user account.

How to use

1. Copy docker-compose.yml to some folder

2. Open a Windows Command Line Prompt in that path

3. Run some commands

3.1 Pull the image from Docker Hub to the local machine.

Output

3.2 Start the PostgreSQL container

This post is part of the Docker For Developers tutorial.

You Might Also Like