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 <shahednasser@gmail.com>

* docs: break commang flags into bullet list items

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
Trang Le
2022-08-26 18:20:15 +07:00
committed by GitHub
parent bf9bf7abff
commit 7fd65b1a41

View File

@@ -207,6 +207,23 @@ For other distributions, you can check out [PostgreSQLs website for more guid
You can download PostgreSQL on your macOS using [the installer on their website](https://www.postgresql.org/download/macosx/).
</TabItem>
<TabItem value="docker" label="Docker">
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.
</TabItem>
</Tabs>