官方nginx镜像只有个nginx,调试时不方便
因此在dokcer nginx的容器中安装 ping telnet vim curl ifconfig几个工具很有必要
1、在一台可以访问外网的宿主机运行docker
docker run -it --name=nginx nginx /bin/bash
2、修改docker中的镜像源,提高下载速度
mv /etc/apt/sources.list /etc/apt/sources.list.bak echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list
3、安装工具
apt-get update && apt-get install -y curl telnet vim iputils-ping net-tools
4、退出容器,在宿主机中通过容器导出docker镜像
docker commit nginx my_nginx_image
5、查看并导出刚刚通过容器生成的镜像
docker images
docker save my_nginx_image -o my_nginx.tar
6、将my_nginx.tar复制到任意目标机运行
docker load -i my_nginx.tar
标签:etc,list,ping,apt,vim,nginx,sources,telnet,docker From: https://www.cnblogs.com/wangyin2005/p/16865887.html