我让它正常工作,但现在它停了。我尝试了以下命令,但没有效果:
Docker运行-dns 8.8.8.8 base ping google.com
Docker运行base ping google.com
Sysctl -w net.ipv4。Ip_forward =1 -在主机和容器上
我得到的是未知主机google.com。Docker 0.7.0版本
什么好主意吗?
P.S. ufw也被禁用了
我让它正常工作,但现在它停了。我尝试了以下命令,但没有效果:
Docker运行-dns 8.8.8.8 base ping google.com
Docker运行base ping google.com
Sysctl -w net.ipv4。Ip_forward =1 -在主机和容器上
我得到的是未知主机google.com。Docker 0.7.0版本
什么好主意吗?
P.S. ufw也被禁用了
当前回答
重启docker的方法不是手动,而是使用service或systemctl命令:
service docker restart
or
systemctl restart docker
其他回答
它帮助我:
sudo ip link delete docker0
sudo systemctl stop docker.socket
sudo systemctl stop docker.service
sudo systemctl start docker.socket
sudo systemctl start docker.service
注意:在此之后,接口docker0的ip地址必须是smth,如下所示:
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
我不知道我在做什么,但这对我很有用:
OTHER_BRIDGE=br-xxxxx # this is the other random docker bridge (`ip addr` to find)
service docker stop
ip link set dev $OTHER_BRIDGE down
ip link set dev docker0 down
ip link delete $OTHER_BRIDGE type bridge
ip link delete docker0 type bridge
service docker start && service docker stop
iptables -t nat -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE
iptables -t nat -A POSTROUTING ! -o docker0 -s 172.18.0.0/16 -j MASQUERADE
service docker start
在分角上, 我的问题是,在启动docker服务之前,我没有安装并启动iptables。在启动docker服务之前,请确保iptables服务已启动并运行。
对我来说,我在使用podman时遇到了与redhat/centos/fedora用户相同的问题
firewall-cmd --zone=public --add-masquerade
firewall-cmd --permanent --zone=public --add-masquerade
对于更多的防火墙和podman(或docker) -容器中没有互联网,无法解析主机
唯一能在我的电脑上工作的东西(8.8.8.8不起作用)
找出本地机器中使用的DNS:
$ netstat -ntpl | grep :53
tcp 0 0 10.194.128.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.2.1:53 0.0.0.0:* LISTEN -
修改docker配置sudo vim /etc/docker/daemon.Json基于上述信息在您自己的计算机上
{
"dns": ["192.168.122.1","10.194.128.1"]
}
重启码头工人
sudo ip link delete docker0
sudo systemctl restart docker