本文尝试基于openEuler-20.03-LTS-SP4底包构建opengaussV5.0.1LTS的单机版极简版数据库容器。
一、软件包源
1、openEuler-20.03-LTS容器底包
openEuler-20.03-LTS-SP4
下载链接
sha256:24d8f51c1f3a79eb975c4e498cadd9055bfd708d66c15935ec46664d0f975a7b openEuler-docker.x86_64.tar.xz
下载并重命名为openEuler-20.03-LTS-SP4-docker.x86_64.tar.xz
2、opengauss安装包
下载链接
sha256:5e35ac31fdc03cbc64d00f96d8f3802d85092cd2135f1728068ae4c8aec94584
下载并重命名为:openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2
3、当前准备情况
[root@localhost opengauss]# ll
总用量 159M
-rw-rw-r-- 1 AAAA AAAA 63M 1月 10 15:19 openEuler-20.03-LTS-SP4-docker.x86_64.tar.xz
-rw-rw-r-- 1 AAAA AAAA 97M 1月 10 15:19 openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2
[root@localhost opengauss]# sha256sum *
24d8f51c1f3a79eb975c4e498cadd9055bfd708d66c15935ec46664d0f975a7b openEuler-20.03-LTS-SP4-docker.x86_64.tar.xz
5e35ac31fdc03cbc64d00f96d8f3802d85092cd2135f1728068ae4c8aec94584 openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2
二、容器制作
1、导入openEuler-20.03-LTS-SP3镜像
[root@localhost opengauss]# docker load -i openEuler-20.03-LTS-SP4-docker.x86_64.tar.xz
5d8f141db76b: Loading layer [==================================================>] 309.9MB/309.9MB
Loaded image: openeuler-20.03-lts-sp4:latest
[root@localhost opengauss]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
openeuler-20.03-lts-sp4 latest c7e82d23ef38 4 weeks ago 299MB
2、启动实例
[root@localhost opengauss]# docker run -itd --restart=always --name opengauss --privileged -p 5432:5432 -v /data/opengaussdata:/var/lib/opengauss -v /etc/localtime:/etc/localtime:ro openeuler-20.03-lts-sp4:latest /bin/bash
4e720ca398469c9d9386d4259d9cc7211050df6fb1a29a1fa4ae79427e240d32
[root@localhost opengauss]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e720ca39846 openeuler-20.03-lts-sp4:latest "/bin/bash" 9 seconds ago Up 8 seconds 0.0.0.0:5432->5432/tcp opengauss
3、将安装文件拷贝至容器挂载目录内
[root@localhost opengauss]# cp openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2 /data/opengaussdata/
[root@localhost opengauss]# ll /data/opengaussdata
总用量 97M
-rw-r--r-- 1 root root 97M 1月 10 15:24 openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2
[root@localhost opengauss]# docker exec -it opengauss /bin/bash
Welcome to 5.10.0-60.18.0.50.oe2203.x86_64
System information as of time: Wed Jan 10 16:55:36 CST 2024
System load: 0.00
Processes: 6
Memory used: 13.1%
Swap used: 2.5%
Usage On: 70%
Users online: 0
[root@4e720ca39846 /]# ll /var/lib/opengauss/
total 98564
-rw-r--r-- 1 1000 1000 100925568 Jan 10 15:24 openGauss-5.0.1-openEuler-64bit-2003sp4.tar.bz2
[root@4e720ca39846 /]# cat /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS-SP4)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS-SP4)"
ANSI_COLOR="0;31"
[root@4e720ca39846 /]#
4、确认容器字符集并修改限制(在容器内操作)
[root@4e720ca39846 /]# echo $LANG
en_US.UTF-8
[root@4e720ca39846 /]# echo "* soft nofile 1000000" >> /etc/security/limits.conf
[root@4e720ca39846 /]# echo "* hard nofile 1000000" >> /etc/security/limits.conf
[root@4e720ca39846 /]# echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf
[root@4e720ca39846 /]# tail -n 2 /etc/security/limits.conf
* soft nofile 1000000
* hard nofile 1000000
[root@4e720ca39846 /]# tail -n 1 /etc/security/limits.d/90-nproc.conf
* soft nproc unlimited
5、安装依赖包
1、所需工具
工具
- 支持Python3.6+
2、软件依赖要求