我在win server 2016上运行了一个windows docker容器
可以从网络上的其他节点访问在容器中运行的站点。
容器可以访问互联网(可以访问网络外部的第三方节点),但无法连接到网络中的其他节点。
当在容器中运行的应用程序尝试访问网络中另一台机器(machine_name)上的服务时,它会得到以下错误:
The remote name could not be resolved: machine_name
当应用程序尝试连接到网络上的数据库时:
A network-related or instance-specific error occurred while establishing a connection
因此,容器看起来没有访问权限,或者在intranet上找不到计算机
我运行了docker exec -ti e87633560c6c ipconfig /all,得到了以下结果:
Windows IP Configuration
Host Name . . . . . . . . . . . . : gmsa_acct
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter vEthernet (Container NIC 0b35fe9f):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 00-15-5D-30-F4-1D
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::7939:903e:141f:5c98%24(Preferred)
IPv4 Address. . . . . . . . . . . : 172.22.223.136(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 172.22.208.1
DNS Servers . . . . . . . . . . . : 172.22.208.1
10.xxx
10.xxx
NetBIOS over Tcpip. . . . . . . . : Disabled我在运行容器的机器上运行了这个命令
docker exec e87633560c6c nltest /sc_verify:mydomain.com
Flags: b0 HAS_IP HAS_TIMESERV
Trusted DC Name \\D1dns01.mydomain.com
Trusted DC Connection Status Status = 0 0x0 NERR_Success
Trust Verification Status = 0 0x0 NERR_Success
The command completed successfully奇怪的是,相同的容器在另一台主机上运行时没有任何问题。我们现在正在尝试在新主机上运行它,并遇到了上述问题。
任何帮助都是非常感谢的。
谢谢。
编辑:我可以通过IP地址而不是机器名称进行连接。如何通过机器名称连接?
发布于 2020-10-01 06:52:00
当Docker为其运行的容器创建网络时,默认情况下它会创建一个bridge类型的NATed网络。您可以使用命令docker network ls详细了解容器的网络,结果如下所示:
NETWORK ID NAME DRIVER SCOPE
17e324f45964 bridge bridge local
6ed54d316334 host host local
7092879f2cc8 none null local您可以尝试使用"host“网络配置:
Docker如果对容器使用主机网络模式,则该容器的网络堆栈不会与
主机隔离(容器共享主机的网络命名空间),并且容器不会获得分配的自己的IP地址。例如,如果您运行绑定到端口80的容器,并且使用主机网络,则容器的应用程序在主机的IP地址上的端口80上可用。
https://stackoverflow.com/questions/64142811
复制相似问题