Docker containers cannot access the external network

Release: 2020-04-01 11:51:34
Original
8750 people have browsed it

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
Copy after login

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

net.ipv4.ip_forward=1
Copy after login

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
Copy after login

Then use the following command to restart the network service:

systemctl restart network
Copy after login

For more related tutorials, please pay attention to thedocker tutorialcolumn 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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!