Docker镜像非常小,但是您可以ping
通过以下方式在您的官方ubuntu Docker镜像中安装:
apt-get update
apt-get install iputils-ping
您可能不需要ping
图像,而只是想将其用于测试目的。上面的例子将帮助您。
但是,如果需要ping才能存在于映像中,则可以创建一个Dockerfile
或commit
容器,将上述命令运行到新的映像中。
承诺:
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缓存文件等。