Skip to content

Instantly share code, notes, and snippets.

@ChakshuGautam
Last active October 23, 2019 05:47
Show Gist options
  • Save ChakshuGautam/a2c6325561e349501d02356be6faa807 to your computer and use it in GitHub Desktop.
Save ChakshuGautam/a2c6325561e349501d02356be6faa807 to your computer and use it in GitHub Desktop.
PSQL Docker setup - Cheatbook
# Setup docker engine
# -p 127.0.0.1:5432:5432 instead of -p 5432:5432. If you don’t explicitly tell it to run on localhost, it’ll run on0.0.0.0 which means other folks on the same network will be able to reach it.
# https://hub.docker.com/_/postgres => Gives a lot of info regarding docker secrets which should be the way forward.
docker pull postgres
mkdir -p $HOME/docker/volumes/postgres
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 127.0.0.1:5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment