How to access docker container from another machine on local network

前端 未结 2 665
轮回少年
轮回少年 2021-02-06 16:32

I\'m using Docker for Windows( I am not using Docker Toolbox that use a VM) but I cannot see my container from another machine on local network. In my host everything is perfect

相关标签:
2条回答
  • 2021-02-06 16:55

    In Hyper-V settings, putting "Docker NAT" network in "external" mode worked for me. (I can access to my container on my local network with my host's IP)

    0 讨论(0)
  • 2021-02-06 17:02

    Solution:

    When I installed Docker for Windows, it creates a network called vEthernet (DockerNAT) (Usually with the ip 10.0.75.1)

    My local machine had a network called local area connection with the ip 192.168.0.172(With this ip I was trying to access from other PCs).

    So far, My local Machine had Two networks Conections so that I went to Control panel > NetWork and Sharing center > Change Adapter Settings I selected the two networks and I right-click selected Add to bridge. That create a Third network called Ethernet.

    At this point, I didnt know what was the Ip of Ethernet network, so I executed ipconfig command that show me the ip 192.168.0.17(The settings of local area connection and vEthernet (DockerNAT) disappeared and the ips 10.0.75.1 and 192.168.0.172 stop working).

    With this new ip (192.168.0.17) I tried from other machine in the network and finally I could access to the container(192.168.0.17:5656).

    0 讨论(0)
提交回复
热议问题