1. Simple topology diagram
If the Pingdocker container is ping different at this time because there is no route to the 192.168.1.0/24 network on the host, the host has the opportunity to send the data destined for the 192.168.1.0/24 network to the default route so that the container cannot be reached.
2. Workaround:
1. First of all ensure that the virtual machine can be connected to the Docker container, ping test is smooth
2. Turn off the firewall in the virtual: Systemctl stop Firewalld.service
3. Open the Host (Windows) cmd where you added the route to the 192.168.1.0/24 network.
Packets leading to the 192.168.1.0/24 network are forwarded by 172.20.1.12来
192.168. 1.0 255.255. 255.0 172.20. 1.12
To view the routes added:
You can test connectivity by pinging at this point:
You can now connect to the Docker container via the SSH client:
To connect a Docker container in a virtual machine in a Windows host