[root@node3 dockerfiles]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
opengauss 3.0.0 18f4347e4d04 11 seconds ago 663MB
centos 7.6.1810 f1cb7c7d58b7 3 years ago 202MB
run
[root@node3 dockerfiles]# docker run --name opengauss_3.0.0 --privileged=true -d -e GS_PASSWORD=GaussDB@123 opengauss:3.0.0
77e79f91e71082fd0fff3376adb8de2dbfc4eb257ec0fd5c60d4b110c79e8d9f
[root@node3 dockerfiles]# docker logs opengauss_3.0.0 -f
Message: The supplied GS_PASSWORD is meet requirements.
The files belonging to this database system will be owned by user "omm".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
fixing permissions on existing directory /var/lib/opengauss/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /var/lib/opengauss/data/base/1 ... The core dump path is an invalid directory
2022-10-09 01:40:26.710 [unknown] [unknown] localhost 140475676310592 0[0:0#0] [BACKEND] WARNING: macAddr is 578/2886795266, sysidentifier is 37923857/137466, randomNum is 593369338
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for hdfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
...
...
[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
gsql
[root@node3 dockerfiles]# docker exec -it opengauss_3.0.0 bash
[root@77e79f91e710 /]# su - omm
[omm@77e79f91e710 ~]$ gsql -d postgres -p5432 -r
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------------------
(openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)
一、 下载源码
二、原容器镜像制作
1. 下载介质
2. 安装docker
[root@node3 dockerfiles]# cat /etc/docker/daemon.json { "registry-mirrors":[ "https://9cpn8tt6.mirror.aliyuncs.com", "https://registry.docker-cn.com" ] } [root@node3 dockerfiles]# systemctl restart docker3. buildDockerImage.sh
[root@node3 dockerfiles]# sh buildDockerImage.sh -v 3.0.0 Checking Docker version. Checking if required packages are present and valid... openGauss-3.0.0-CentOS-64bit.tar.bz2: OK ========================== DOCKER info: Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Docker Buildx (Docker Inc., v0.9.1-docker) scan: Docker Scan (Docker Inc., v0.17.0) Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.18 Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc version: v1.1.4-0-g5fd4c4d init version: de40ad0 Security Options: seccomp Profile: default Kernel Version: 3.10.0-957.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.62GiB Name: node3 ID: RPLL:AKDC:SMRS:XLID:E2UB:Y6WU:HAUI:FX66:IKXO:TNZD:SRNY:TDDL Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false ========================== Building image 'opengauss:3.0.0' ... Sending build context to Docker daemon 101.2MB Step 1/14 : FROM centos:7.6.1810 7.6.1810: Pulling from library/centos ac9208207ada: Downloading [======> ] 9.104MB/75.16MB ^C [root@node3 dockerfiles]# vi /etc/docker/daemon.json [root@node3 dockerfiles]# systemctl restart docker [root@node3 dockerfiles]# cat /etc/docker/daemon.json { "registry-mirrors":[ "https://9cpn8tt6.mirror.aliyuncs.com", "https://registry.docker-cn.com" ] } [root@node3 dockerfiles]# systemctl restart docker [root@node3 dockerfiles]# sh buildDockerImage.sh -v 3.0.0 Checking Docker version. Checking if required packages are present and valid... openGauss-3.0.0-CentOS-64bit.tar.bz2: OK ========================== DOCKER info: Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Docker Buildx (Docker Inc., v0.9.1-docker) scan: Docker Scan (Docker Inc., v0.17.0) Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.18 Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux Default Runtime: runc Init Binary: docker-init containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc version: v1.1.4-0-g5fd4c4d init version: de40ad0 Security Options: seccomp Profile: default Kernel Version: 3.10.0-957.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.62GiB Name: node3 ID: RPLL:AKDC:SMRS:XLID:E2UB:Y6WU:HAUI:FX66:IKXO:TNZD:SRNY:TDDL Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Registry Mirrors: https://9cpn8tt6.mirror.aliyuncs.com/ https://registry.docker-cn.com/ Live Restore Enabled: false ========================== Building image 'opengauss:3.0.0' ... Sending build context to Docker daemon 101.2MB Step 1/14 : FROM centos:7.6.1810 7.6.1810: Pulling from library/centos ac9208207ada: Pull complete Digest: sha256:62d9e1c2daa91166139b51577fe4f4f6b4cc41a3a2c7fc36bd895e2a17a3e4e6 Status: Downloaded newer image for centos:7.6.1810 ---> f1cb7c7d58b7 Step 2/14 : COPY openGauss-3.0.0-CentOS-64bit.tar.bz2 . ---> 1d0cbd868984 Step 3/14 : COPY gosu-amd64 /usr/local/bin/gosu ---> 928758582360 Step 4/14 : ENV LANG en_US.utf8 ---> Running in 9aa647847dd5 Removing intermediate container 9aa647847dd5 ---> e221f4ad7757 Step 5/14 : RUN set -eux; yum install -y bzip2 bzip2-devel curl libaio&& groupadd -g 70 omm; useradd -u 70 -g omm -d /home/omm omm; mkdir -p /var/lib/opengauss && mkdir -p /usr/local/opengauss && mkdir -p /var/run/opengauss && mkdir /docker-entrypoint-initdb.d && tar -jxf openGauss-3.0.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chown -R omm:omm /var/lib/opengauss && chown -R omm:omm /docker-entrypoint-initdb.d && chmod 2777 /var/run/opengauss && rm -rf openGauss-3.0.0-CentOS-64bit.tar.bz2 && yum clean all ---> Running in c24660db34d1 + yum install -y bzip2 bzip2-devel curl libaio Loaded plugins: fastestmirror, ovl Determining fastest mirrors * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn Resolving Dependencies --> Running transaction check ---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed ---> Package bzip2-devel.x86_64 0:1.0.6-13.el7 will be installed ---> Package curl.x86_64 0:7.29.0-51.el7 will be updated ---> Package curl.x86_64 0:7.29.0-59.el7_9.1 will be an update --> Processing Dependency: libcurl = 7.29.0-59.el7_9.1 for package: curl-7.29.0-59.el7_9.1.x86_64 ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed --> Running transaction check ---> Package libcurl.x86_64 0:7.29.0-51.el7 will be updated ---> Package libcurl.x86_64 0:7.29.0-59.el7_9.1 will be an update --> Processing Dependency: libssh2(x86-64) >= 1.8.0 for package: libcurl-7.29.0-59.el7_9.1.x86_64 --> Running transaction check ---> Package libssh2.x86_64 0:1.4.3-12.el7 will be updated ---> Package libssh2.x86_64 0:1.8.0-4.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: bzip2 x86_64 1.0.6-13.el7 base 52 k bzip2-devel x86_64 1.0.6-13.el7 base 218 k libaio x86_64 0.3.109-13.el7 base 24 k Updating: curl x86_64 7.29.0-59.el7_9.1 updates 271 k Updating for dependencies: libcurl x86_64 7.29.0-59.el7_9.1 updates 223 k libssh2 x86_64 1.8.0-4.el7 base 88 k Transaction Summary ================================================================================ Install 3 Packages Upgrade 1 Package (+2 Dependent packages) Total download size: 876 k Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. warning: /var/cache/yum/x86_64/7/base/packages/bzip2-devel-1.0.6-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for bzip2-devel-1.0.6-13.el7.x86_64.rpm is not installed Public key for curl-7.29.0-59.el7_9.1.x86_64.rpm is not installed -------------------------------------------------------------------------------- Total 2.3 MB/s | 876 kB 00:00 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Importing GPG key 0xF4A80EB5: Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) " Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 Package : centos-release-7-6.1810.2.el7.centos.x86_64 (@CentOS) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libssh2-1.8.0-4.el7.x86_64 1/9 Updating : libcurl-7.29.0-59.el7_9.1.x86_64 2/9 Updating : curl-7.29.0-59.el7_9.1.x86_64 3/9 Installing : libaio-0.3.109-13.el7.x86_64 4/9 Installing : bzip2-1.0.6-13.el7.x86_64 5/9 Installing : bzip2-devel-1.0.6-13.el7.x86_64 6/9 Cleanup : curl-7.29.0-51.el7.x86_64 7/9 Cleanup : libcurl-7.29.0-51.el7.x86_64 8/9 Cleanup : libssh2-1.4.3-12.el7.x86_64 9/9 Verifying : bzip2-devel-1.0.6-13.el7.x86_64 1/9 Verifying : curl-7.29.0-59.el7_9.1.x86_64 2/9 Verifying : libssh2-1.8.0-4.el7.x86_64 3/9 Verifying : bzip2-1.0.6-13.el7.x86_64 4/9 Verifying : libcurl-7.29.0-59.el7_9.1.x86_64 5/9 Verifying : libaio-0.3.109-13.el7.x86_64 6/9 Verifying : curl-7.29.0-51.el7.x86_64 7/9 Verifying : libssh2-1.4.3-12.el7.x86_64 8/9 Verifying : libcurl-7.29.0-51.el7.x86_64 9/9 Installed: bzip2.x86_64 0:1.0.6-13.el7 bzip2-devel.x86_64 0:1.0.6-13.el7 libaio.x86_64 0:0.3.109-13.el7 Updated: curl.x86_64 0:7.29.0-59.el7_9.1 Dependency Updated: libcurl.x86_64 0:7.29.0-59.el7_9.1 libssh2.x86_64 0:1.8.0-4.el7 Complete! + groupadd -g 70 omm + useradd -u 70 -g omm -d /home/omm omm + mkdir -p /var/lib/opengauss + mkdir -p /usr/local/opengauss + mkdir -p /var/run/opengauss + mkdir /docker-entrypoint-initdb.d + tar -jxf openGauss-3.0.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss + chown -R omm:omm /var/run/opengauss + chown -R omm:omm /usr/local/opengauss + chown -R omm:omm /var/lib/opengauss + chown -R omm:omm /docker-entrypoint-initdb.d + chmod 2777 /var/run/opengauss + rm -rf openGauss-3.0.0-CentOS-64bit.tar.bz2 + yum clean all Loaded plugins: fastestmirror, ovl Cleaning repos: base extras updates Cleaning up list of fastest mirrors Removing intermediate container c24660db34d1 ---> f4ae499280cf Step 6/14 : RUN set -eux; echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc ---> Running in 2476e733860c + echo 'export GAUSSHOME=/usr/local/opengauss' + echo 'export PATH=$GAUSSHOME/bin:$PATH ' + echo 'export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH' Removing intermediate container 2476e733860c ---> d3ef4604a117 Step 7/14 : ENV GOSU_VERSION 1.12 ---> Running in f9651ff17661 Removing intermediate container f9651ff17661 ---> 09120578b30d Step 8/14 : RUN set -eux; chmod +x /usr/local/bin/gosu ---> Running in f3e98497815c + chmod +x /usr/local/bin/gosu Removing intermediate container f3e98497815c ---> 49ea79f289ca Step 9/14 : ENV PGDATA /var/lib/opengauss/data ---> Running in 8904d7dd69f7 Removing intermediate container 8904d7dd69f7 ---> e7bd16787dd3 Step 10/14 : COPY entrypoint.sh /usr/local/bin/ ---> a76ddb916acd Step 11/14 : RUN chmod 755 /usr/local/bin/entrypoint.sh;ln -s /usr/local/bin/entrypoint.sh / # backwards compat ---> Running in f9d0c641357b Removing intermediate container f9d0c641357b ---> ddd27afee5a5 Step 12/14 : ENTRYPOINT ["entrypoint.sh"] ---> Running in f5b70bbdc217 Removing intermediate container f5b70bbdc217 ---> cd3a184c91ad Step 13/14 : EXPOSE 5432 ---> Running in 82b77be1ebe9 Removing intermediate container 82b77be1ebe9 ---> 1ebed742aefc Step 14/14 : CMD ["gaussdb"] ---> Running in 66fc27eca766 Removing intermediate container 66fc27eca766 ---> 18f4347e4d04 Successfully built 18f4347e4d04 Successfully tagged opengauss:3.0.0 openGauss Docker Image 3.0.0 is ready to be extended: --> opengauss:3.0.0 Build completed in 90 seconds.4. 启动容器
[root@node3 dockerfiles]# docker run --name opengauss_3.0.0 --privileged=true -d -e GS_PASSWORD=GaussDB@123 opengauss:3.0.0 77e79f91e71082fd0fff3376adb8de2dbfc4eb257ec0fd5c60d4b110c79e8d9f [root@node3 dockerfiles]# docker logs opengauss_3.0.0 -f Message: The supplied GS_PASSWORD is meet requirements. The files belonging to this database system will be owned by user "omm". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". fixing permissions on existing directory /var/lib/opengauss/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 32MB creating configuration files ... ok Begin init undo subsystem meta. [INIT UNDO] Init undo subsystem meta successfully. creating template1 database in /var/lib/opengauss/data/base/1 ... The core dump path is an invalid directory 2022-10-09 01:40:26.710 [unknown] [unknown] localhost 140475676310592 0[0:0#0] [BACKEND] WARNING: macAddr is 578/2886795266, sysidentifier is 37923857/137466, randomNum is 593369338 ok initializing pg_authid ... ok setting password ... ok initializing dependencies ... ok loading PL/pgSQL server-side language ... ok creating system views ... ok creating performance views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok initialize global configure for bucketmap length ... ok creating information schema ... ok loading foreign-data wrapper for distfs access ... ok loading foreign-data wrapper for hdfs access ... ok loading foreign-data wrapper for log access ... ok loading hstore extension ... ok loading foreign-data wrapper for MOT access ... ok loading security plugin ... ok update system tables ... ok creating snapshots catalog ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok freezing database template0 ... ok freezing database template1 ... ok freezing database postgres ... ok ... ... [0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.[root@node3 dockerfiles]# docker exec -it opengauss_3.0.0 bash [root@77e79f91e710 /]# su - omm [omm@77e79f91e710 ~]$ gsql -d postgres -p5432 -r gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. openGauss=# select version(); version ------------------------------------------------------------------------------------------------------------------------------------------------------ (openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit (1 row)由于篇幅限制,新容器镜像制作、PR提交及优化总结请继续阅读 优化openGauss官方容器源码(二)