After the Linux virtual machine is suspended and restarted, the docker container startup status cannot be accessed

Solution:

[root@kai8wu sysctl.d]# pwd
/usr/lib/sysctl.d
[root@kai8wu sysctl.d]# vim 00-system.conf
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
net.ipv4.ip_forward = 1 # 加入此句
# 重启网络
[root@kai8wu sysctl.d]# systemctl restart network

By editing 00-system.confthe file, the network parameter settings of the system are actually changed

The meanings of these parameters are as follows:

  • net.bridge.bridge-nf-call-ip6tables: Disable IPv6 iptables calls to ensure that the filtering of IPv6 packets will not affect the network access of Docker containers.
  • net.bridge.bridge-nf-call-iptables: Disable iptables calls to ensure that packet filtering does not affect the network access of the Docker container.
  • net.bridge.bridge-nf-call-arptables: Disable the arptables call to ensure that the filtering of ARP packets will not affect the network access of the Docker container.
  • net.ipv4.ip_forward: Enable IPv4 packet forwarding, allowing packets to be routed and forwarded between network interfaces.

After you modify these parameters, you need to restart the network service to make the changes take effect by executing commands systemctl restart network.

The purpose of these modifications is to ensure that the network configuration is correctly configured to allow port access for the Docker container after the virtual machine restarts. These parameter settings are usually used to solve the problem of network access of Docker containers in virtual machines. Note that the applicability of these parameters may vary in your specific environment, so make sure you understand their implications and proceed with caution before applying them.

 Excerpt from: After the Linux virtual machine is suspended and restarted, the startup status of the docker container cannot be accessed

Guess you like

Origin blog.csdn.net/liuruiaaa/article/details/130834723