Skip to content

oesni/dockerize-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerize postgresql database

Dockerize running postgresql database. All database on target server is dockerized.

Update env.sh

# 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"

Run dockerize.sh

# command should be run in git root directory
zsh dockerize.sh
# or
bash dockerize.sh
# or  ...

Run docker image

ex)

docker run -e POSTGRES_PASSWORD=password mypostgres

Run docker image with docker-compose

docker-compose up

Reference

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published