For example, how do I write mongo that connects to the host in docker? Do you need to make additional configuration on the host?
For example, the public ip of the host is 188.8.131.52 and the internal ip is 184.108.40.206
1. Execute the following command on the host
iptables -A INPUT -i docker0 -j ACCEPT
2. Enter the container and execute the command.
root@fdbbff27a91c:/# ip route
default via 172.17.0.1 dev eth0
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.2
172.17.0.1 is obtained and the host can be accessed through this address.
Please refer to: