Port connections to database in docker-compose

Do you have any info on running services in docker-compose?

We usually use that for postgis and elasticsearch (
safecastapi/docker-compose.yml at master · Safecast/safecastapi · GitHub) but when I try inside gitpod the connections to localhost:5432 or localhost:9200 seem to just get rejected.

I’d guess the docker-in-docker environment is leading to some oddness.

Do I need to count on installing postgis and elasticsearch directly into the gitpod docker image?

(If yes my next question would be: how do I install postgis 11? Seems like only 12 is available on the gitpod/workspace-full image.)

If you don’t bound your ports to 127.0.0.1 it should work:

...
 ports:
      - "${SC_API_WEB_PORT:-3000}:3000"
...

instead of

...
 ports:
      - "127.0.0.1:${SC_API_WEB_PORT:-3000}:3000"
...

Ahh… that’s great @corneliusludmann. Thanks I’ll try that and report back.

1 Like

Works great! Good eye @corneliusludmann :+1:

1 Like