From 7fd65b1a41e80211810dc354e72a69d3759bc520 Mon Sep 17 00:00:00 2001 From: Trang Le Date: Fri, 26 Aug 2022 18:20:15 +0700 Subject: [PATCH] docs: add instruction for setting up PostgreSQL with Docker (#2103) * docs: set up Postgre with Docker * docs: link to installing Postgres with Docker * docs: add tab for Docker * docs: remove link to setting up Postgres with Docker * docs: make sure Docker Desktop is running Co-authored-by: Shahed Nasser * docs: break commang flags into bullet list items Co-authored-by: Shahed Nasser Co-authored-by: Shahed Nasser --- .../0-set-up-your-development-environment.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/content/tutorial/0-set-up-your-development-environment.mdx b/docs/content/tutorial/0-set-up-your-development-environment.mdx index 395acde205..6197bf3af3 100644 --- a/docs/content/tutorial/0-set-up-your-development-environment.mdx +++ b/docs/content/tutorial/0-set-up-your-development-environment.mdx @@ -207,6 +207,23 @@ For other distributions, you can check out [PostgreSQL’s website for more guid You can download PostgreSQL on your macOS using [the installer on their website](https://www.postgresql.org/download/macosx/). + + + +Make sure the Docker Desktop app is running, then run the following command to quickly spin up a PostgreSQL instance: + +```bash +docker run --name postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=medusa-docker -p 5432:5432 -d postgres +``` + +Where: + +- `--name` creates a new container named `postgres`. +- `-e` creates environment variables `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_DB`. These will be used to set up a database named `medusa-docker` with the username and password being `postgres`. +- `-p` maps the container port `5432` to the external host `5432`. This allows you to connect to the database server from outside of the container. +- `-d` enables Docker to run the container in the background. +- The last section of the command, `postgres` grabs the latest postgres image from the Docker hub. +