创建自己的基础镜像

1、把当前的环境打包

# tar --numeric-owner --exclude=/proc --exclude=/sys -cvf centos7-base.tar /

2、制作镜像

把打包的tar包通过docker import 命令生成镜像,镜像名字为centos7_test

# cat centos7-base.tar |docker import - centos7_test

3、测试

# docker run -it --rm centos7_test cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

借鉴:https://www.cnblogs.com/alexkn/p/3879540.html

原文地址:https://www.cnblogs.com/yjt1993/p/12795482.html