Created
August 14, 2018 11:11
-
-
Save jillesvangurp/284dbb0a117014608c980e213ec9b391 to your computer and use it in GitHub Desktop.
postgres with ssl cerficiates workaround for initdb and non empty data dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate certificate and key with openssl and then mount them | |
version: '2.3' | |
postgres: | |
image: postgres:alpine | |
# specify location to the keys explicitly | |
command: -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key | |
environment: | |
POSTGRES_DB: mydb | |
POSTGRES_USER: user | |
POSTGRES_PASSWORD: secret | |
# mount outside of the data dir so you don't get errors about the data dir not being empty | |
volumes: | |
- ./ca/server.crt:/var/lib/postgresql/server.crt | |
- ./ca/server.key:/var/lib/postgresql/server.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment