Dockerize running postgresql database. All database on target server is dockerized.
# file name for sql dump
export BACKUP_SQL="mypg-dump-$(date +%Y-%m-%d).sql"
# postgresql server info
export SERVER_URL="localhost"
export SERVER_PORT="5432"
export SERVER_USER="postgres"
export SERVER_PSWD="postgres"
# docker image&tag name to build
export IMAGE_NAME="mypg"
export IMAGE_TAG="latest"
# command should be run in git root directory
zsh dockerize.sh
# or
bash dockerize.sh
# or ...
ex)
docker run -e POSTGRES_PASSWORD=password mypostgres
docker-compose up
https://hub.docker.com/_/postgres
https://github.com/docker-library/docs/blob/master/postgres/README.md
https://oesni.github.io/til/dockerize-postgresql/
Any Environment Variables and Configurations on this documentation should work.