How can I have my Postgres image create more than one database? For example, I want to do something like this:
- image: circleci/postgres:9.6.7-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: db_test
POSTGRES_DB: db_special
Is there a way to do this? And if not, how can I go about creating the second database with the same roles as the first?
Disclaimer: Developer Advocate at CircleCI
I see three options for you.
localhost
and the second by a name you set.Here's an example for #3:
- image: circleci/my-main-image:latest
- image: circleci/postgres:9.6.7-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: db_test
- image: circleci/postgres:9.6.7-alpine
name: pg2
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: db_special