您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Docker-Ubuntu-bash:ping:找不到命令

Docker-Ubuntu-bash:ping:找不到命令

Docker镜像非常小,但是您可以ping通过以下方式在您的官方ubuntu Docker镜像中安装:

apt-get update
apt-get install iputils-ping

您可能不需要ping图像,而只是想将其用于测试目的。上面的例子将帮助您。

但是,如果需要ping才能存在于映像中,则可以创建一个Dockerfilecommit容器,将上述命令运行到新的映像中。

承诺:

docker commit -m "Installed iputils-ping" --author "Your Name <name@domain.com>" ContainerNameOrId yourrepository/imagename:tag

Dockerfile:

FROM ubuntu
RUN apt-get update && apt-get install -y iputils-ping
CMD bash

请注意,有创建docker映像的最佳做法,例如在之后清除apt缓存文件等。

其他 2022/1/1 18:15:25 有444人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶