Skip to content

Instantly share code, notes, and snippets.

@DavidSolus
Last active February 28, 2022 00:05
Show Gist options
  • Save DavidSolus/46ea9114d06908e6058b0db8cdb47756 to your computer and use it in GitHub Desktop.
Save DavidSolus/46ea9114d06908e6058b0db8cdb47756 to your computer and use it in GitHub Desktop.
Quickly setup Postgres database using Docker (Mac/Linux)

Simple tutorial on how to quickly setup a postgres database on a Mac using Terminal and Docker Desktop.

Creating the Docker container and image

Open terminal and run this command:

docker run --name postgres_image -e POSTGRES_PASSWORD=password -d postgres

Screen Shot 2021-12-26 at 11 18 10 PM

Accessing the image

Open the Docker CLI for the image and run this command:

psql -h localhost -p 5432 -U postgres

Screen Shot 2021-12-26 at 11 22 19 PM Screen Shot 2021-12-26 at 11 22 44 PM

Basic Postgres commands to get started

Postgres Tutorial - psql Commands

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