我对docker和linux完全陌生,我正在尝试从docker容器中ping google。我收到以下错误...
vagrant@vagrant-ubuntu-trusty-64:~$ docker run ubuntu ping google.com
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec: \"ping\":
executable file not found in $PATH": unknown.如上所述,我在vagrant上使用了ubuntu/trusty64 box。
我已经在我的漫游文件中启用了一个公共网络
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"并且可以从虚拟机ping google
vagrant@vagrant-ubuntu-trusty-64:~$ ping google.com
PING google.com (216.58.204.46) 56(84) bytes of data.
64 bytes from lhr25s12-in-f14.1e100.net (216.58.204.46): icmp_seq=1 ttl=52 time=29.5 ms
64 bytes from lhr25s12-in-f14.1e100.net (216.58.204.46): icmp_seq=2 ttl=52 time=36.2 ms
64 bytes from lhr25s12-in-f14.1e100.net (216.58.204.46): icmp_seq=3 ttl=52 time=95.7 ms但似乎不是在码头容器内。
我试过这个解决方案,但没有用-- https://odino.org/cannot-connect-to-the-internet-from-your-docker-containers/
这里会有什么问题呢?
谢谢,
发布于 2018-02-28 23:21:32
错误消息告诉您"ping“命令不包含在ubuntu基础镜像中。Docker镜像是精简的,你需要安装任何你想在其中运行的应用程序。如果使用/bin/bash运行容器,则可以使用以下命令在该容器中安装ping:
apt-get update && apt-get install iputils-ping你可以在nicolaka/netshoot中找到ping和许多其他预装的网络工具,我喜欢它们用于网络故障排除:
docker run -it --rm nicolaka/netshoot ping www.google.comhttps://stackoverflow.com/questions/49025616
复制相似问题