Open
Description
Snippet of my config :
postgres:
image: postgres:10-alpine
container_name: postgres
ports:
- 5432:5432
volumes:
- "./.data/postgresql:/var/lib/postgresql/data"
- ./utils/postgres:/docker-entrypoint-initdb.d
environment:
POSTGRES_MULTIPLE_DATABASES: "service_database, service_database_test"
POSTGRES_PASSWORD: "password"
POSTGRES_USER: "service_database"
In this case, the postgres image will create a database named "service_database" by default, then the multi db script will try to create "service_database" and "service_database_test" but will fail on "service_database" because the database already exists.
The workaround is easy: remove "service_database" from POSTGRES_MULTIPLE_DATABASES and eventually using POSTGRES_DB but it seems hacky to have to use multiple variables.