如果报错和我一样。不用怕,我已经走在前面
[root@localhost ~]# docker run learn/ping ping www.baidu.com
WARNING: IPv4 forwarding is disabled. Networking will not work.
container_linux.go:235: starting container process caused "exec: \"ping\": executable file not found in $PATH"
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"ping\": executable file not found in $PATH".
两个步骤
①修改 vi /etc/sysctl.conf文件,添加 net.ipv4.ip_forward = 1
②docker run learn/ping /bin/sh -C && ping www.baidu.com
docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown.
cdm2020-10-04 19:55:41
docker run learn/tutorial /bin/sh -C && ping www.baidu.com
[root@localhost ~]# docker run learn/ping ping www.baidu.com
WARNING: IPv4 forwarding is disabled. Networking will not work.
container_linux.go:235: starting container process caused "exec: \"ping\": executable file not found in $PATH"
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"ping\": executable file not found in $PATH".
两个步骤
①修改 vi /etc/sysctl.conf文件,添加 net.ipv4.ip_forward = 1
②docker run learn/ping /bin/sh -C && ping www.baidu.com
CentOS7命令:
systemctl restart network
systemctl restart docker
CentOS6的命令会不一样,ubuntu的不知道呢
sha256:cbd4e6e7053ec0093b21f30cc06feeba9ac6781cf7c890e42e7d33c942c94e72
[root@node1 ~]# docker run learn/ping ping www.google.com后面没有数据显示了。
^CPING www.google.com (31.13.72.34) 56(84) bytes of data.
--- www.google.com ping statistics ---
70 packets transmitted, 0 received, 100% packet loss, time 69552ms
docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown.