我们有一个docker compose文件,允许我们在使用Windows容器时ping容器IP(从Windows主机到容器)。
version: '3'
services:
netcorewebapplication1:
image: netcorewebapplication1
build:
context: .
dockerfile: NetCoreWebApplication1/Dockerfile
## Windows
networks:
nat:
ipv4_address: 172.30.235.10
networks:
nat:
external: true
但是在切换到Linux容器后,我们无法ping到容器IP
version: '3'
services:
netcorewebapplication1:
image: netcorewebapplication1
build:
context: .
dockerfile: NetCoreWebApplication1/Dockerfile
## Linux user defined bridge network
networks:
my_net:
ipv4_address: 172.30.235.10
networks:
my_net:
external: true
为什么无法ping或浏览Linux容器IP地址?