先启动1个容器:docker run -it centos7 /bin/bash 安装和配置自己需要的应用![]()
重新打开一个shell docker commit 容器ID 新的镜像名称 docker commit 433dd64d7e3a centos7_ifconfig
![]()
查看制作的镜像信息: docker inspect centos7_ifconfig
使用自定义镜像来启动容器,测试ifconfig docker run -it centos7_ifconfig /bin/bash
使用自定义镜像来启动后台容器 docker run -d centos7_ifconfig /bin/bash -c 'while true;do echo hello;sleep 3;done'
使用commit制作自定义镜像是不推荐的,官方推荐使用Dockerfile来制作自定义镜像