我看到了很多与docker类似的网络问题,但没有什么可以帮助我了解这里出了什么问题以及如何解决。
基本上,我对容器中的公共IP进行了卷曲,但无法访问服务器:
来自主机(出于安全原因,我已将IP替换为XXX):
root@vultr ~]# curl http://207.246.XXX.XXX -vvvv
* About to connect() to 207.246.XXX.XXX port 80 (#0)
* Trying 207.246.XXX.XXX...
* Connected to 207.246.XXX.XXX (207.246.XXX.XXX) port 80 (#0)
> GET / HTTP/1.1
[root@vultr ~]# curl http://google.com -vvvv
* About to connect() to google.com port 80 (#0)
* Trying 2607:f8b0:4008:80e::200e...
* Connected to google.com (2607:f8b0:4008:80e::200e) port 80 (#0)
> GET / HTTP/1.1
从容器中
bash-4.4# curl http://207.246.XXX.XXX -vvvv
* Rebuilt URL to: http://207.246.XXX.XXX/
* Trying 207.246.XXX.XXX...
* TCP_NODELAY set
* connect to 207.246.XXX.XXX port 80 failed: Host is unreachable
* Failed to connect to 207.246.XXX.XXX port 80: Host is unreachable
* Closing connection 0
curl: (7) Failed to connect to 207.246.XXX.XXX port 80: Host is unreachable
bash-4.4# curl http://google.com -vvvv
* Rebuilt URL to: http://google.com/
* Trying 172.217.3.78...
* TCP_NODELAY set
* Connected to google.com (172.217.3.78) port 80 (#0)
> GET / HTTP/1.1
我想了解到底发生了什么,如何正确配置docker以解析IP并以与主机相同的方式访问url。
谢谢