# 调整grub菜单中内核选项,将刚才的内核调整在首选 [root@localhost ~]# grub2-set-default 0 [root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.0.8-1.el7.elrepo.x86_64 Found initrd image: /boot/initramfs-6.0.8-1.el7.elrepo.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-ea14c7e6d9ba41a79901fbe4fd310e44 Found initrd image: /boot/initramfs-0-rescue-ea14c7e6d9ba41a79901fbe4fd310e44.img done
# 升级完内核需要重启 [root@localhost ~]# reboot [root@localhost ~]# hostnamectl Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: ea14c7e6d9ba41a79901fbe4fd310e44 Boot ID: 5b3ebaeb4006420bbd902849bddb2b8c Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 6.0.8-1.el7.elrepo.x86_64 Architecture: x86-64
Options: --builder string Override the configured builder instance
Management Commands: imagetools Commands to work on images in registry
Commands: bake Build from a file build Start a build create Create a new builder instance du Disk usage inspect Inspect current builder instance ls List builder instances prune Remove build cache rm Remove a builder instance stop Stop builder instance use Set the current builder instance version Show buildx version information
Run 'docker buildx COMMAND --help' for more information on a command. [root@localhost ~]# docker buildx version github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
# 配置支持多cpu架构平台模拟器 [root@localhost ~]# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus Setting /usr/bin/qemu-sparc64-static as binfmt interpreter for sparc64 Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64 Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32 Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64 Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4 Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64 Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32 Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64 Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k Setting /usr/bin/qemu-hexagon-static as binfmt interpreter for hexagon
# 相关文件已放置git仓库 [root@localhost ~]# git clone https://gitea.xadocker.cn/container-image/mysql.git [root@localhost ~]# cd mysql [root@localhost mysql]# ll mysql-5.7.38/ total 60 -rwxr-xr-x 1 root root 16145 Nov 14 20:18 docker-entrypoint.sh -rw-r--r-- 1 root root 2049 Nov 14 20:41 dockerfile.2image -rw-r--r-- 1 root root 951 Nov 14 20:40 dockerfile.bin2image.ubuntu -rw-r--r-- 1 root root 36039 Nov 14 20:18 install-db.sh
[root@localhost mysql]# cd mysql-5.7.38/ [root@localhost mysql-5.7.38]# cat dockerfile.bin2image.ubuntu FROM ubuntu:20.10 MAINTAINER 1793360097@qq.com # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql COPY install-db.sh /usr/local/bin/ RUN bash /usr/local/bin/install-db.sh && rm -rf /usr/local/src/* && rm -rf /usr/local/mysql/bin/{mysqltest_embedded,mysql_embedded,mysql_client_test_embedded} /usr/local/mysql/mysql-test RUN mkdir -p /etc/mysql/conf.d/ && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql/share /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime && chmod 1777 /var/run/mysqld /var/lib/mysql
# 构建出来的镜像好大。。。对比了下官方的才0.5G,不知道少了啥 [root@localhost mysql-5.7.38]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql mysql-bin:5.7.38-ubuntu 05ba82071e80 22 minutes ago 2.93GB ubuntu 20.10 2f8908083042 15 months ago 71.8MB
[root@localhost mysql-5.7.38]# cat dockerfile.2image FROM ubuntu:20.10 as builder MAINTAINER 1793360097@qq.com # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql COPY install-db.sh /usr/local/bin/ RUN bash /usr/local/bin/install-db.sh && rm -rf /usr/local/src/* && rm -rf /usr/local/mysql/bin/{mysqltest_embedded,mysql_embedded,mysql_client_test_embedded} /usr/local/mysql/mysql-test RUN mkdir -p /etc/mysql/conf.d/ && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql/share /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime && chmod 1777 /var/run/mysqld /var/lib/mysql
FROM ubuntu:20.10 COPY --from=builder /usr/local/mysql/* /usr/local/mysql RUN groupadd -r mysql && useradd -r -g mysql mysql && mkdir -p /var/lib/mysql/share /var/run/mysqld /docker-entrypoint-initdb.d && chown mysql:mysql -R /usr/local/mysql /var/lib/mysql /var/run/mysqld /docker-entrypoint-initdb.d
# 构建出来的镜像太大了,2G+...... root@iZwz9cu8gh0lswws7x1lvqZ:~/mysql/mysql-5.7.38# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql 5.7.38-ubuntu.10 70bdcc26ad31 2 hours ago 2.76GB gitea.xadocker.cn/container-image/mysql-arm64 5.7.38 70bdcc26ad31 2 hours ago 2.76GB