DOCKER 第二步 现有 CentOS8 系统打包 Docker 镜像


一、现有系统 Centos8.5 操作:

系统里最好不安装 Docker,否则会报错

卸载不必要软件包

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

清理yum缓存

ndf clean all

rm -rf /var/cache/dnf 

打包文件系统

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/CentOS8-mysql-nginx-php.tar.gz /  

或者 ,加 压缩 

tar -zcvf /var/tmp/CentOS8-mysql-nginx-php.tar.gz \
--exclude=/boot/* \
--exclude=/proc/* \
--exclude=/dev/* \
--exclude=/sys/* \
--exclude=/home/* \
--exclude=/var/lib/* \
--exclude=/lib/modules/* \
--exclude=/var/cache/* \
--exclude=/project/* \
--exclude=/tmp/dxb/* \
--exclude=/root/gitlab*  /

二、使用

导入前面打包好的镜像 

docker load --input mycentos.tar.gz 

导入并运行 

docker import CentOS8-mysql-nginx-php.tar centos8 docker run -itd --name xx centos8:latest /bin/bash

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值