Skip to main content
9 events
when toggle format what by license comment
May 13, 2023 at 9:47 history edited tom CC BY-SA 4.0
docker network is different from host machine
May 13, 2023 at 9:39 comment added tom Thanks.I have already figured it out, my http server run at 127.0.0.1 :9999, the network namespace is not the real ip address in my windows system, so I edited 127.0.0.1 to 0.0.0.0 and solved the problem. I understand it by reading this blog pythonspeed.com/articles/docker-connection-refused
May 13, 2023 at 6:33 history migrated from stackoverflow.com (revisions)
May 13, 2023 at 6:28 comment added tom I also tried this docker run command is :docker run -p 8899:9999 --network=host my-Image. It's still useless
May 13, 2023 at 6:25 comment added tom No,I use windows 10 to run the docker. I developed a simple k-v server on my windows 10,I expose 9999 port in the server to receive a "Get" http method,it respond key's value. The complete curl command in docker shell is :curl "localhost:9999/api?key=Tom" ,It‘s worked. I also build docker image and run docker on windows 10 system.
May 12, 2023 at 20:42 comment added David Maze --net host disables Docker's networking layer, and among other things means -p port mappings don't work. You should almost never need this option, and it can cause trouble if you're using Docker Desktop or a similar VM-based solution. Does removing this work?
May 12, 2023 at 20:40 comment added Itagyba Abondanza Kuhlmann By the way, are you using WSL to run the docker command? I am confused when you say Windows Host machine. Can you describe in more detail your topology?
May 12, 2023 at 20:31 comment added Itagyba Abondanza Kuhlmann Can you provide the complete curl command and its output? You could also run nc -zv localhost 8899 and provide the output here too.
May 12, 2023 at 20:01 history asked tom CC BY-SA 4.0