Docker Community Forums

Share and learn in the Docker community.

Cannot access app by container IP


(Andrii Parfonov) #1

I can see the app on localhost. But I need to access it by IP as well. I have read similar threads but all in vain.

docker inspect shows 172.17.0.2. Why can’t I see my app when I go to that IP? Why is it just localhost?

Also, how can I get the VM IP?


(Richard Tong) #2

I just had the same issue. It looks like there is automatic mapping happening in docker for mac. So if you do a -v 3000:3000 for instance then automatically this port gets mapped to Mac port 3000, but the behavior seems unreliable. I’ve been trying to use node-inspector on port 8080 and it has worked once but then fails.


(Alexandre) #3

You might want to look into these threads:




(Mickael BARON) #4

@Andrii Parfonov, do you solve your problem ? I’ve the same problem. I tested on a Linux distribution and it’s working.

On Docker4Mac (1.12.2) i can’t use any container by IP.

Mickael


(Conny Brunnkvist) #5

I thought I had this problem: the docs don’t say exactly clearly what will happen when switching from docker-machine/vbox (of Docker Toolbox) to D. for Mac and basically no network access was working, automatic or -p explicit, container IP (found only via network inspect or host IP.

I eventually realized that run parameters must come before, not after, the image name. doh Then forwarding turned out to be working just fine.

Not sure but that might be something that has changed in recent versions.


(Wovo) #6

So you should be able to access containers from your container host using the container IP . You can use docker inspect <container ID> to get your container’s IP address.

Does that answer your question?

With Regards,
Xovo Larjem https://8ballpool.onl/
https://omegle.onl/


(Seomelon06) #7

Thanks for the good ideas to bring it. I know a lot more. :slight_smile: สมัคร ufabet :J