Docker 在compose中未解析容器名称,但IP为
我在compose模式下运行了两个容器。容器可以通过IP相互通信,但不能通过容器名称进行通信,这是无法解析的 Docker网络检查容器运行的位置Docker 在compose中未解析容器名称,但IP为,docker,networking,docker-compose,docker-for-windows,docker-networking,Docker,Networking,Docker Compose,Docker For Windows,Docker Networking,我在compose模式下运行了两个容器。容器可以通过IP相互通信,但不能通过容器名称进行通信,这是无法解析的 Docker网络检查容器运行的位置 正在尝试按容器名称ping另一个容器中的一个容器: PS C:\inetpub\wwwroot> ping mycompose_brimdb_1 Ping request could not find host mycompose_brimdb_1. Please check the name and try again 正在尝试按服务名称
正在尝试按容器名称ping另一个容器中的一个容器:
PS C:\inetpub\wwwroot> ping mycompose_brimdb_1
Ping request could not find host mycompose_brimdb_1. Please check the name and try again
正在尝试按服务名称ping:
PS C:\inetpub\wwwroot> ping brimdb
Ping request could not find host brimdb. Please check the name and try again.
正在尝试通过IP ping同一容器:
PS C:\inetpub\wwwroot> ping 172.25.113.185
Pinging 172.25.113.185 with 32 bytes of data:
Reply from 172.25.113.185: bytes=32 time=1ms TTL=128
Reply from 172.25.113.185: bytes=32 time<1ms TTL=128
Reply from 172.25.113.185: bytes=32 time=5ms TTL=128
Reply from 172.25.113.185: bytes=32 time<1ms TTL=128
Ping statistics for 172.25.113.185:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 5ms, Average = 1ms
使用定义时在compose中设置的服务名称。建议不错,但我也尝试过,没有。。。我的缺点是,添加到dscript中,所以我才意识到-另一个容器甚至可以通过容器ID来解析,但不能通过名称或服务来解析。。。
PS C:\inetpub\wwwroot> ping 172.25.113.185
Pinging 172.25.113.185 with 32 bytes of data:
Reply from 172.25.113.185: bytes=32 time=1ms TTL=128
Reply from 172.25.113.185: bytes=32 time<1ms TTL=128
Reply from 172.25.113.185: bytes=32 time=5ms TTL=128
Reply from 172.25.113.185: bytes=32 time<1ms TTL=128
Ping statistics for 172.25.113.185:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 5ms, Average = 1ms
version: "3.7"
services:
brim:
image: brim:latest
ports:
- target: 50893
published: 50893
protocol: tcp
brimdb:
image: brimdb:latest
ports:
- target: 1555
published: 1555
protocol: tcp