1

I am running locally my docker container. The container basically is a web application. I can establish communication from my host machine to the container by request the endpoint e.g. POST http://localhost:2200/myservice/book .

Then, I find out the IP address of my local machine 192.168.10.32, I thought I could still communicate with the container on my host by replacing localhost to my IP address e.g. `POST http://192.168.10.32:2200/myservice/book . But I can't, the containerized web app can't be reached at all. Why is that? I am under a wifi network.

My firewall is actually off: enter image description here

Leem
  • 17,220
  • 36
  • 109
  • 159
  • did you allow that port thru the firewall? – Daniel A. White Aug 16 '19 at 13:31
  • 1
    what command did you use to start the docker container? – niko Aug 16 '19 at 13:33
  • @DanielA.White, I am using a Macbook, how to check that firewall thing? – Leem Aug 16 '19 at 13:36
  • @niko I use `docker-compose -p myWebApp up -d` – Leem Aug 16 '19 at 13:37
  • @Leem here is how to open a port under Mac OS X https://support.apple.com/en-us/HT201642 – niko Aug 16 '19 at 13:37
  • My firewall is in "off" status, do I still need to turn it on and configure? – Leem Aug 16 '19 at 13:51
  • 2
    @Leem in that case please post your docker-compose.yml file – niko Aug 16 '19 at 14:08
  • 1
    Did you double-check the IP address listened by Spring Boot is `0.0.0.0`? Otherwise I guess that this thread would amount to a duplicate of [How do I access a spring app running in a docker container?](https://stackoverflow.com/questions/52633726/how-do-i-access-a-spring-app-running-in-a-docker-container/52729289#52729289) – ErikMD Aug 16 '19 at 14:54
  • 1
    From where did you try to reach the container (same host, other machine but same network, from the internet)? – Henry Aug 16 '19 at 16:07
  • Your host IP (192.168.10.32) is a provate address, thats why you can communicate your machine with your container, but you cannot access you container from outside (internet), to do that you need to get your public IP address and forward a port or something to the address you want – Facundo Diaz Cobos Aug 16 '19 at 19:01
  • @Henry from the same host I am trying to reach the container. – Leem Aug 16 '19 at 20:07
  • What does `docker-machine ip dev` return? – ErikMD Aug 18 '19 at 17:42

0 Answers0