docker-centos制作基础镜像

Python publisher01 40℃

制作自己的基础镜像

创建自己的镜像,放置于/root目录下

01:

最小化安装centos7.6

02:

systemctl disable firewalld.service

rpm -e kernel

yum -y remove \

bind-libs  bind-libs-lite \

dhclient    dhcp-common  dhcp-libs            dracut-network \

e2fsprogs e2fsprogs-libs    ebtables            ethtool \

file            firewalld            freetype \

gettext    gettext-libs        groff-base            grub2        grub2-tools  grubby \

initscripts  iproute              iptables              kexec-tools \

libcroco                              libgomp              libmnl        libnetfilter_conntrack  libnfnetlink  libselinux-python  lzo  libunistring \

os-prober                          python-decorator python-slip python-slip-dbus \

snappy                              sysvinit-tools \

which                                linux-firmware      GeoIP          firewalld-filesystem \

qemu-guest-agent

03:

yum clean all

rm -rf /boot

rm -rf /etc/firewalld

rm -rf /var/cache/yum/x86_64

rm -f /tmp/ks-script*

rm -rf /etc/sysconfig/network-scripts/ifcfg-*

rm -rf /etc/udev/hwdb.bin

rm -rf /usr/lib/udev/hwdb.d/*

umount /run

rm /var/run/nologin

yum install -y net-tools

04:

mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.back

localedef -f UTF-8 -i zh_CN zh_CN.UTF8

localedef –list-archive

rm -f /usr/lib/locale/locale-archive.back

05:

rpm –rebuilddb

06:

tar –numeric-owner –exclude=/boot –exclude=/proc –exclude=/sys -cvf centos7.6-docker.tar /

tar –numeric-owner –exclude=/boot \

–exclude=/etc/selinux/targeted \

–exclude=/proc \

–exclude=/run \

–exclude=/sys \

–exclude=/usr/lib/firmware \

–exclude=/usr/lib/grub \

–exclude=/usr/lib/kbd \

–exclude=/usr/lib64/NetworkManager \

–exclude=/usr/lib64/libasound.so.2.0.0 \

–exclude=/usr/lib64/libmozjs-17.0.so \

–exclude=/usr/lib64/libnm.so.0.1.0 \

–exclude=/usr/lib64/libslang.so.2.2.4 \

–exclude=/usr/lib64/xtables \

–exclude=/usr/libexec/nm-iface-helper \

–exclude=/usr/libexec/postfix \

–exclude=/usr/sbin/NetworkManager \

–exclude=/usr/sbin/eapol_test \

–exclude=/usr/share/alsa \

–exclude=/usr/share/backgrounds/* \

–exclude=/usr/share/doc \

–exclude=/usr/share/hwdata \

–exclude=/usr/share/info/*.gz \

–exclude=/usr/share/kde4 \

–exclude=/usr/share/man \

–exclude=/usr/share/locale/* \

–exclude=/var/cache/yum \

-cvf centos7.6-docker.tar /

转载请注明:Python量化投资 » docker-centos制作基础镜像

喜欢 (0)or分享 (0)