Home > Article > Operation and Maintenance > What should I do if docker cannot connect to the web page?
What should I do if docker cannot connect to the web page?
Solutions to the problem that Docker cannot connect to the web page:
6 solutions to the problem that the Docker container cannot connect to the Internet
Note: The following The method is to be able to ping the public IP in the container. If the public IP cannot be pinged, the host may not be able to access the Internet (try ping 8.8.8.8)
1. Use --net:host option
sudo docker run --net:host --name Ubuntu_bash -i -t ubuntu:latest /bin/bash
2. Use --dns option
sudo docker run --dns 8.8.8.8 --dns 8.8.4.4 --name ubuntu_bash -i -t ubuntu:latest /bin/bash
3.Change dns server
vi /etc/default/docker
Remove the # before "docker_OPTS="--dns 8.8.8.8 --dns 8.8.4.4""
##4. No need for dnsmasq
vi /etc/NetworkManager/NetworkManager.confAdd a # sign before dns=dnsmasq and comment out
sudo restart docker
5. Rebuild docker0 network
pkill dockeriptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d
6. Modify /etc/hosts directly in docker
Docker installation application (CentOS 6.5_x64):http://www.linuxidc.com/Linux/2014-07/104595.htm
http://www.linuxidc.com/Linux /2014-01/95354.htm
http://www.linuxidc.com/Linux/2014-10 /108184.htm
http://www.linuxidc.com/Linux/2014-07/104595.htm
http://www.linuxidc.com/linux/2014-08/105656.htm
http://www.linuxidc.com/Linux/2014-11/109107.htm
docker video tutorial"
The above is the detailed content of What should I do if docker cannot connect to the web page?. For more information, please follow other related articles on the PHP Chinese website!