0

I am running the Django Cookiecutter on Docker and tried to connect to the postgres database using Postico, a GUI client on my laptop.

The credentials I used was basically the same as .envs/.local/.postgres Yet I still cannot connect.

I wonder what's the issue that's blocking me from doing so?

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282

1 Answers1

1

The issue is that I wasn't aware that Docker allows you to state which ports get mapped to the host OS.

See https://docs.docker.com/compose/compose-file/#network_mode for details.

Specifically, I needed to go to local.yml under postgres definition and add:

ports:
      - "5432:5432"

Then restart the docker.

In case you want to map different port number note that the syntax is

the HOST:CONTAINER format
Kim Stacks
  • 10,202
  • 35
  • 151
  • 282