Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdecode/08b662f40c1acac3259a4b1210b17cc7 to your computer and use it in GitHub Desktop.
Save jdecode/08b662f40c1acac3259a4b1210b17cc7 to your computer and use it in GitHub Desktop.
Install PostgreSQL on localhost using Docker

Prerequisite : Docker should be installed (Google "How to install docker") duh!

  1. docker pull postgres:latest (Pick your tag if you know)

  2. mkdir -p $HOME/docker/volumes/postgres (Ubuntu/Debian/Linux based systems)

  3. docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres

  4. You can connect using psql -h localhost -U postgres -d postgres - Password is docker (set in above command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment