将现有的系统环境文件打包成Docker镜像文件

一、现有A系统Centos7操作:

备注:A系统里最好不安装Docker,否则会报错

卸载不必要软件包

yum remove -y iwl* *firmware* --exclude=kernel-firmware

清理yum缓存

yum clean all
rm -rf /var/cache/yum

打包文件系统

tar --numeric-owner --exclude=/proc --exclude=/sys --exclude=/mnt --exclude=/var/cache --exclude=/usr/share/{foomatic,backgrounds,perl5,fonts,cups,qt4,groff,kde4,icons,pixmaps,emacs,gnome-background-properties,sounds,gnome,games,desktop-directories} --exclude=/var/log -zcvf /mnt/CentOS7-BaseImage.tar /

二、另一个装有Docker的B系统来使用

docker import CentOS7-BaseImage.tar centos7 
docker run
-itd --name xx centos7:latest /bin/bash
原文地址:https://www.cnblogs.com/hiit/p/15016187.html