Quantcast
Viewing all articles
Browse latest Browse all 56

Django server not accessible when run through docker-compose: connection reset by peer

I have a docker image which runs django. Docker-compose is like this:

services:  www:    image: my-www-image    ports:      - "80:80"

If I docker exec -ti bash into this container and curl localhost, I get Django-related output, and the docker-compose log notes the GET request.

If I go to the host machine and curl localhost, I get

curl: (56) Recv failure: Connection reset by peer

(note this is not a Connection refused, which I would get if I use a random wrong port number)

Adding EXPOSE 80 to the Dockerfile made no difference.

Why can't the host machine connect to the otherwise-working service inside the container?


Viewing all articles
Browse latest Browse all 56

Trending Articles