I'm fairly new to Docker
and I'm trying to create a Django development container. I have Postgres
database running on my PC on port 5432
.
I run this command:
docker run --env-file .env.dev -p 127.0.0.1:5432:5432 test sh -c "python manage.py makemigrations && python manage.py migrate"
Which returns:
Error starting userland proxy: listen tcp4 127.0.0.1:5432: bind: address already in use.
I understand that host port 5432
is already in use by Postgres
but AFAIK I should map dockers 5432
to 5432
to be able to connect to the database, shouldn't I?