Use environment variable for password in Docker
We were getting an error since we started using the postgres 9.6 image: ``` Attaching to app_1, database_1 database_1 | Error: Database is uninitialized and superuser password is not specified. database_1 | You must specify POSTGRES_PASSWORD to a non-empty value for the database_1 | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". database_1 | database_1 | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all database_1 | connections without a password. This is *not* recommended. database_1 | database_1 | See PostgreSQL documentation about "trust": database_1 | https://www.postgresql.org/docs/current/auth-trust.html ```
This commit is contained in:
@@ -6,7 +6,8 @@ services:
|
|||||||
# use the preferred version of the official Postgres image
|
# use the preferred version of the official Postgres image
|
||||||
# see https://hub.docker.com/_/postgres/
|
# see https://hub.docker.com/_/postgres/
|
||||||
image: postgres:9.6.21
|
image: postgres:9.6.21
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||||
# persist the database between containers by storing it in a volume
|
# persist the database between containers by storing it in a volume
|
||||||
volumes:
|
volumes:
|
||||||
- docker-example-postgres:/var/lib/postgresql/data
|
- docker-example-postgres:/var/lib/postgresql/data
|
||||||
@@ -37,6 +38,7 @@ services:
|
|||||||
- bundle:/usr/local/bundle:delegated
|
- bundle:/usr/local/bundle:delegated
|
||||||
- "$SSH_AUTH_SOCK:/tmp/agent.sock"
|
- "$SSH_AUTH_SOCK:/tmp/agent.sock"
|
||||||
environment:
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||||
- SSH_AUTH_SOCK=/tmp/agent.sock
|
- SSH_AUTH_SOCK=/tmp/agent.sock
|
||||||
volumes:
|
volumes:
|
||||||
docker-example-postgres: {}
|
docker-example-postgres: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user