Home  >  Article  >  Operation and Maintenance  >  Docker containers cannot access the external network

Docker containers cannot access the external network

尚
Original
2020-04-01 11:51:348822browse

Docker containers cannot access the external network

The Docker container cannot access the external network:

The following situations occur:

The Docker container cannot access the external network

Other machines in the LAN cannot access the docker service

Startup error docker warning ipv4 forwarding is disabled. networking will not work

Solution:

Use the following command to open sysctl.conf File

vi /etc/sysctl.conf

Then add the following code in the sysctl.conf file:

net.ipv4.ip_forward=1

You can use the sysctl net.ipv4.ip_forward command to check whether the modification is successful. The results returned after the modification is successful are as follows:

net.ipv4.ip_forward = 1

Then use the following command to restart the network service:

systemctl restart network

For more related tutorials, please pay attention to the docker tutorial column of the PHP Chinese website.

The above is the detailed content of Docker containers cannot access the external network. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn