Galaxy Kirin server system docker environment imports the base image, installs openjdk-1.8.0 and repackages it

In the docker environment of the Galaxy Kirin server system, import the base image, install openjdk-1.8.0 and repackage

      • 1. System version
      • 2. Install docker and start the service
          • 1. Configure external network source
          • 2.Install docker package
          • 3. Start the service and set it to start automatically at boot
      • 3. Base image import configuration
          • 1. Upload the base image and import it
          • 2. View the imported docker image
          • 3. Start the docker image
          • 4. Enter the docker container image
          • 5.Install java-1.8.0-openjdk
          • 6. Exit and close the container
          • 7. Make the container into an image
          • 8. Export and compress the completed image

1. System version

[root@localhost ~]# nkvers
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Sword)

Kernel:
4.19.90-24.4.v2101.ky10.x86_64

Build:
Kylin Linux Advanced Server
release V10 (SP2) /(Sword)-x86_64-Build09/20210524
################################################

2. Install docker and start the service

1. Configure external network source
[root@localhost ~]# cat /etc/yum.repos.d/kylin_x86_64.repo
###Kylin Linux Advanced Server 10 - os repo###

[ks10-adv-os]
name = Kylin Linux Advanced Server 10 - Os
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP2/os/adv/lic/base/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled=1

[ks10-adv-updates]
name = Kylin Linux Advanced Server 10 - Updates
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP2/os/adv/lic/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled=1

[ks10-adv-addons]
name = Kylin Linux Advanced Server 10 - Addons
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP2/os/adv/lic/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 0
2. Install docker package
[root@localhost ~]# yum install docker -y
3. Start the service and set it to start automatically at boot
[root@localhost ~]# systemclt restart docker
[root@localhost ~]# systemclt enable docker

3. Base image import configuration

1. Upload the base image and import it
[root@localhost ~]# docker load < Kylin-Server-10-SP2-Release-Build09-Docker-20210524-X86_64.xz
e0d4d61f5225: Loading layer [================================================ =====>] 323.5MB/323.5MB
db0a4a95ca8e: Loading layer [================================================ =====>] 2.048kB/2.048kB
534cfc05830b: Loading layer [================================================ =====>] 48.8MB/48.8MB
Loaded image: kylin-server-10-sp2-x86:b09
2. View the imported docker image
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kylin-server-10-sp2-x86 b09 907d7ff37c7c 2 years ago 358MB
3. Start the docker image
[root@localhost ~]# docker run -d --name kylin --privileged=true kylin-server-10-sp2-x86:b09 /usr/sbin/init
d148cf50ad030338670532c5174c205bbda5f1de8bd3cd6d521b3c2a01b60362

[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d148cf50ad03 kylin-server-10-sp2-x86:b09 "/usr/sbin/init" 4 seconds ago Up 3 seconds kylin
4. Enter the docker container image
[root@localhost ~]# docker exec -it kylin /bin/bash
[root@d148cf50ad03 /]#
[root@d148cf50ad03 /]# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
5. Install java-1.8.0-openjdk
[root@d148cf50ad03 yum.repos.d]# yum install java-1.8.0-openjdk -y
Last metadata expiration check: 0:00:25 ago on Wed Nov 1 09:06:59 2023.
Dependencies resolved.
================================================== ================================================== ================================================== =============================
 Package Architecture Version Repository Size
================================================== ================================================== ================================================== =============================
Installing:
 java-1.8.0-openjdk x86_64 1:1.8.0.342.b07-0.p02.ky10 ks10-adv-updates 364 k
Installing dependencies:
 alsa-lib x86_64 1.2.3-1.ky10 ks10-adv-os 433k
 copy-jdk-configs noarch 4.0-1.ky10 ks10-adv-updates 27 k
 fontconfig x86_64 2.13.92-1.ky10 ks10-adv-os 215k
 freetype x86_64 2.10.2-4.ky10 ks10-adv-updates 494 k
 java-1.8.0-openjdk-headless x86_64 1:1.8.0.342.b07-0.p02.ky10 ks10-adv-updates 33 M
 javapackages-filesystem noarch 5.3.0-2.ky10 ks10-adv-os 9.8k
 libX11 x86_64 1.6.9-7.ky10 ks10-adv-updates 733 k
 libXcomposite x86_64 0.4.5-1.ky10 ks10-adv-os 12k
 libXext x86_64 1.3.4-2.ky10 ks10-adv-os 34k
 libXi x86_64 1.7.10-1.ky10 ks10-adv-os 34k
 libXrender x86_64 0.9.10-10.ky10 ks10-adv-os 24k
 libXtst x86_64 1.2.3-10.ky10 ks10-adv-os 18k
 libfontenc x86_64 1.1.4-2.ky10 ks10-adv-os 18k
 lksctp-tools x86_64 1.0.18-1.ky10 ks10-adv-os 61k
 lua-posix x86_64 33.3.1-12.ky10 ks10-adv-os 168k
 nspr x86_64 4.26.0-2.ky10 ks10-adv-os 133k
 nss x86_64 3.54.0-9.p01.ky10 ks10-adv-updates 623 k
 nss-softokn x86_64 3.54.0-9.p01.ky10 ks10-adv-updates 656 k
 nss-util x86_64 3.54.0-9.p01.ky10 ks10-adv-updates 443 k
 pkgconf x86_64 1.7.3-2.ky10 ks10-adv-updates 56k
 tzdata-java noarch 2020a-8.p02.ky10 ks10-adv-updates 149 k
 xorg-x11-font-utils x86_64 1:7.5-43.ky10 ks10-adv-os 84k
 xorg-x11-fonts-others noarch 7.5-24.ky10 ks10-adv-os 7.4 M

Transaction Summary
================================================== ================================================== ================================================== =============================
Install 24 Packages

Total download size: 45M
Installed size: 135M
Is this ok [y/N]: y
Downloading Packages:
(1/24): javapackages-filesystem-5.3.0-2.ky10.noarch.rpm 98 kB/s | 9.8 kB 00:00
(2/24): libXcomposite-0.4.5-1.ky10.x86_64.rpm 344 kB/s | 12 kB 00:00
(3/24): alsa-lib-1.2.3-1.ky10.x86_64.rpm 2.8 MB/s | 433 kB 00:00
(4/24): libXi-1.7.10-1.ky10.x86_64.rpm 1.4 MB/s | 34 kB 00:00
................................................................. ............
6. Exit and close the container
[root@d148cf50ad03 /]# exit
[root@localhost ~]# docker stop d148cf50ad03
7. Make the container into an image
[root@localhost ~]# docker commit d148 kylin-server-v10-sp2-x86-openjdk-1.8:b09
sha256:b42f0e2453d6ac05b0b15e327a31cdc62279939c7c8e77a40096d2056cb72ea4
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kylin-server-v10-sp2-x86-openjdk-1.8 b09 b42f0e2453d6 5 seconds ago 578MB
kylin-server-10-sp2-x86 b09 907d7ff37c7c 2 years ago 358MB
8. Export and compress the completed image
[root@localhost ~]# docker save -o Kylin-Server-10-SP2-Release-Build09-Docker-20210524-X86_64-openjdk-1.8.0.xz kylin-server-v10-sp2-x86-openjdk -1.8:b09

[root@localhost ~]# tar zcvf Kylin-Server.tar.gz Kylin-Server-10-SP2-Release-Build09-Docker-20210524-X86_64-openjdk-1.8.0.xz