I run nginx container on my azure Vm, centos 7 with this command:
docker run --name nginx2 --detach -p 0.0.0.0:90:80 nginx
Now If I run this command on the host machine: curl localhost:90 I got the error:
curl: (56) Recv failure: Connection reset by peer
What I tried:
- On my local machine
I follow the same steps on my local machine and everything works like a charm. So the nginx image is not the problem
- Inside the container
On my VM, I connect to the nginx container and run the command : curl localhost:80 and got the answer. So nginx listen on port 80.
- From another container
If I create a second container and run the command curl <nginx-ip>:80. I got the result. So nginx not listen only on localhost, but on all ip.
- host network
When I run the container using Host Newtork --network host, everything work fine. But I don't want to do that
- Try with another container
I try using this container:
docker run -p 8000:8000 -it python:3.7-slim python3 -m http.server --bind 0.0.0.0. But same error.
My question is what is the problem with bridge network on Centos ?