---
title: "Comment by kalle on \"🐳 Docker with Strapi V4 🌟\" | Hashnode"
description: "Hi Simen, Thanks for your demo. I hade to change docker - compose up - d postgresdb &amp; &amp; yarn develop to docker - compose up - d strapi &amp; &amp; yarn"
url: "https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99"
---

[Discussion](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd)

Comment [🐳 Docker with Strapi V4 🌟](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd)

[kalle](https://hashnode.com/@anka)

[Feb 5, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99)

Hi Simen,

Thanks for your demo. I hade to change

```
docker-compose up -d postgresdb && yarn develop
```

to

```
docker-compose up -d strapi && yarn develop
```

as the .env as strapi as I get that

> no such service: postgresdb

But my the error I am getting when running with

```
docker-compose up -d strapi && yarn develop
```

is the following:

> debug: ⛔️ Server wasn't able to start properly. error: The server does not support SSL connections

Have you run into this issue? I am on Mac OS Monterey v12.2 and node v 16.3.0

The

```
docker-compose up -d
```

is working without errors

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 5, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-61fec1878d15cb3e7ce634ae)

You can use docker-compose up -d to start both. PostgresDB etc needs to match the name of the service. Not had that error lastime i got it service was not running.

[kalle](https://hashnode.com/@anka)

[Feb 6, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-61ff69f1fd8b083e5728da14)

[Simen Daehlin](https://hashnode.com/@eventyret)

I looked into the logs, one of the issues was that the log was telling that: "Error: Knex: run $ npm install pg --save Cannot find module 'pg'" I checked the package.json file, and there was no pg installed, so when I installed strapi without the quick flag the local instance is running, when using docker-compose up -d as you mentioned, but when using docker-compose up -d strapi && yarn develop the Container postgresDB starts running, Container strapi starts but shuts after the following error: debug: ⛔️ Server wasn't able to start properly. error: role "strapi" does not exist As I am really new at this, how do I make the production db open in browser, in the same way I can run the [localhost](http://localhost:1337/) strapi in browser?

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 6, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-61ffae008d15cb3e7ce6457d)

[kalle](https://hashnode.com/@anka) It seems I missed installing knex and pg as dependencies when using postgres so will rectify that in the guide.

I think the reason is we need to give postgres a default database. Will try to update this on my laptop today.

[kalle](https://hashnode.com/@anka)

[Feb 6, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-61ffe912295d27600677490e)

[Simen Daehlin](https://hashnode.com/@eventyret)

Great, looking forward to your update :) And it would be great to connect postgres with a default database as you mentioned. If possible please extend your article to how to deploy this on Heroku using Herokus's Container Registry and the Use Heroku CLI

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 7, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-62015d303a8a6e5fe119a1f7)

[kalle](https://hashnode.com/@anka) I might add an extra blog entry for Herokus's Container Registry Using Heroku CLI and how to set it up there :)

[kalle](https://hashnode.com/@anka)

[Feb 8, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-620222eccb8b977b256baaf4)

[Simen Daehlin](https://hashnode.com/@eventyret)

Thanks for the update, in your recent update, is there provision for the following, the postgres is not running on port http://localhost:5432, you replied with the following "I think the reason is we need to give postgres a default database. Will try to update this on my laptop today." Or have I missed something in your update?

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 8, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-620243712a32740589abfd68)

[kalle](https://hashnode.com/@anka) So to make it work.

```
docker-compose up -d postgresdb && yarn develop
```

needs to be

```
docker-compose up -d postgresDB && yarn develop
```

note capital DB unless you changed it in `docker-compose.yml` file to be all lowercase.

If it still fails check that it starts. `bash docker logs postgresDB -f` if it says it's accepting connections then you can do `yarn develop`

Also the setting `DATABASE_HOST=localhost` can be set to `0.0.0.0` to make it available on any IP it seems to be a bit weird on mac. I had the same issue running it just as a container.

[kalle](https://hashnode.com/@anka)

[Feb 8, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-62028a15457dec06830c8211)

[Simen Daehlin](https://hashnode.com/@eventyret) Running the following command: docker-compose up -d postgresDB && yarn develop gives me the following error: debug: ⛔️ Server wasn't able to start properly. error: role "strapi" does not exist

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 8, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-6202bb65457dec06830c87b8)

[kalle](https://hashnode.com/@anka) How does your docker-compose file look?

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 8, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-6202bbb6b6c216065a359e1f)

[kalle](https://hashnode.com/@anka) [blog.dehlin.dev/strapi-v4-with-docker-and-heroku](https://blog.dehlin.dev/strapi-v4-with-docker-and-heroku) Heroku deployment with docker

[kalle](https://hashnode.com/@anka)

[Feb 9, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-6203524d457dec06830c9253)

[Simen Daehlin](https://hashnode.com/@eventyret) Thanks :)

[kalle](https://hashnode.com/@anka)

[Feb 9, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-62035315b6c216065a35a92d)

[Simen Daehlin](https://hashnode.com/@eventyret)

{ "name": "docker-strapi-ps", "private": true, "version": "0.1.0", "description": "A Strapi application", "scripts": { "develop": "strapi develop", "start": "strapi start", "build": "strapi build", "strapi": "strapi" }, "devDependencies": {}, "dependencies": { "@strapi/strapi": "4.0.7", "@strapi/plugin-users-permissions": "4.0.7", "@strapi/plugin-i18n": "4.0.7", "pg": "8.6.0" }, "author": { "name": "A Strapi developer" }, "strapi": { "uuid": "40a2ddf2-fcc4-4f67-b1e6-1360678a556f" }, "engines": { "node": ">=12.x.x <=16.x.x", "npm": ">=6.0.0" }, "license": "MIT" }

[Simen Daehlin](https://hashnode.com/@eventyret)

[Feb 9, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-620368e7b6c216065a35ab76)

[kalle](https://hashnode.com/@anka) That's your package.json not your docker-compose file 😂😊

[kalle](https://hashnode.com/@anka)

[Feb 10, 2022](https://hashnode.com/posts/docker-with-strapi-v4/61dcb820cda0d0294b69c3cd/comment/61fec0adfd8b083e5728cf99#reply-6204d5679e350308247fcc00)

[Simen Daehlin](https://hashnode.com/@eventyret) sorry :) heres the docker-compose file:

version: "3" services: strapi: container\_name: strapi build: . image: mystrapi:latest restart: unless-stopped env\_file: .env environment: DATABASE\_CLIENT: ${DATABASE\_CLIENT} DATABASE\_HOST: postgresDB DATABASE\_NAME: ${DATABASE\_NAME} DATABASE\_USERNAME: ${DATABASE\_USERNAME} DATABASE\_PORT: ${DATABASE\_PORT} JWT\_SECRET: ${JWT\_SECRET} DATABASE\_PASSWORD: ${DATABASE\_PASSWORD} NODE\_ENV: ${NODE\_ENV} links:

```
  - postgresDB:postgresDB
volumes:
  - ./config:/opt/app/config
  - ./src:/opt/app/src
  - ./package.json:/opt/package.json
  - ./yarn.lock:/opt/yarn.lock
  - ./.env:/opt/app/.env
ports:
  - "1337:1337"
networks:
  - strapi
depends_on:
  - postgresDB
```

postgresDB: image: postgres:12.0-alpine container\_name: postgresDB restart: unless-stopped env\_file: .env environment: POSTGRES\_USER: ${DATABASE\_USERNAME} POSTGRES\_PASSWORD: ${DATABASE\_PASSWORD} volumes:

```
  - ./data:/var/lib/postgresql/data/
ports:
  - "5432:5432"
networks:
  - strapi
```

networks: strapi: name: Strapi driver: bridge
