In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to achieve docker cross-host communication". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve docker cross-host communication".
# A Host 192.168.100.12
Create a subnet in host A with a range of 10.52.100.2-> 10.52.100.254
Docker network create-subnet=10.52.100.0/24 snake120
Run a centos7 container as a client
Docker run-name centos-dit-network snake120-ip 10.52.100.2 uhub.service.ucloud.cn/pub021/centos:7.4.1708
Add a route to the host where the destination address is located,-net destination IP, gw gateway IP, default eth0 Nic
Route add-net 10.52.121.0 netmask 255.255.255.0 gw 192.168.100.121
Server-side open forwarding rules for communication from host B to host A.
Iptables-A FORWARD-j ACCEPT
# B host 192.168.100.12
Create a subnet in host B with a range of 10.52.121.2-> 10.52.121.254
Docker network create-subnet=10.52.121.0/24 snake121
Run a target service
Docker run-name nginx-dit-network snake121-ip 10.52.121.10 uhub.service.ucloud.cn/pub021/nginx:1.17.10
Server-side open forwarding rules for communication from host A to host B.
Iptables-A FORWARD-j ACCEPT
Add a route to the host where the destination address is located,-net target IP, gw gateway IP, default eth0 network card. This is to initiate communication from host B to host An actively and communicate with each other.
Route add-net 10.52.120.0 netmask 255.255.255.0 gw 192.168.100.120 Thank you for your reading, the above is the content of "how to achieve docker cross-host communication". After the study of this article, I believe you have a deeper understanding of how to achieve docker cross-host communication, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.