|
1
|
When connecting your Medusa application to a PostgreSQL Docker container, make sure the `5432` port is exposed. |
|
2
|
|
|
3
|
To do that, either pass the `-p` option to the `docker run` command. For example: |
|
4
|
|
|
5
|
```bash |
|
6
|
docker run -d -p 5432:5432 --name some-postgres -e POSTGRES_PASSWORD=supersecret postgres |
|
7
|
``` |
|
8
|
|
|
9
|
Or, if you're using Docker Desktop, you can provide the option under the container's "Optional settings" collapsable. |
|
10
|
|
|
11
|
 |
|
12
|
|
|
13
|
If you expose the PostgreSQL docker container at a port other than `5432`, make sure to include it in your database URL. |
|
14
|
|
|
15
|
When installing Medusa with `create-medusa-app`, you can provide a database URL with the different port using the `--db-url` option. |
|
16
|
|
|
17
|
For example: |
|
18
|
|
|
19
|
```bash npx2yarnExec |
|
20
|
npx create-medusa-app@latest --db-url "postgres://user:password@localhost:<YOUR_PORT>/medusa-store" |
|
21
|
``` |
|
22
|
|
|
23
|
Where `<YOUR_PORT>` is the exposed port if it's different than `5432`. |
|
24
|
|
|
25
|
Refer to the [databaseUrl configuration documentation](!docs!/learn/configurations/medusa-config#databaseUrl) to learn how to set the database URL for an installed Medusa application. |