通过Dockerfile创建海量数据库VastbaseG100的docker镜像
1.Dockerfile文件内容
FROM centos:centos8
LABEL maintainer="xh"
COPY Vastbase-G100-installer-2.2_Build15\(17408\)-kylin_v10sp2-x86_64-no_mot-20231221.tar.gz /opt
COPY db_install.rsp /opt
COPY docker-entrypoint.sh /opt
RUN set -x \
&& cd /etc/yum.repos.d/ \
&& mv CentOS-Linux-AppStream.repo CentOS-Linux-AppStream.repo.back \
&& curl -o ./CentOS-Linux-AppStream.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo \
&& mv CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo.back \
&& cp CentOS-Linux-AppStream.repo CentOS-Linux-BaseOS.repo \
&& yum clean all \
&& yum makecache \
&& yum install -y zlib-devel libaio libuuid readline-devel krb5-libs libicu libxslt tcl perl openldap pam openssl-devel libxml2 bzip2 net-tools gettext which glibc-langpack-en \
&& echo "RemoveIPC=no" >> /etc/systemd/logind.conf \
&& echo "RemoveIPC=no" >> /usr/lib/systemd/system/systemd-logind.service \
&& cd /usr/lib64/ \
&& ln -sv libreadline.so libreadline.so.8 \
&& useradd -m vastbase \
&& echo 'vastbase:Tong@123' | chpasswd \
&& mkdir -p /soft/vb \
&& mv /opt/Vastbase-G100-installer-2.2_Build15\(17408\)-kylin_v10sp2-x86_64-no_mot-20231221.tar.gz /soft/vb/ \
&& mv /opt/db_install.rsp /soft/vb/ \
&& mv /opt/docker-entrypoint.sh /soft/vb/ \
&& cd /soft/vb \
&& tar -xvf Vastbase-G100-installer-2.2_Build15\(17408\)-kylin_v10sp2-x86_64-no_mot-20231221.tar.gz \
&& chown -R vastbase:vastbase /soft/vb/ \
&& chmod -R 775 /soft/vb/
USER vastbase
RUN set -x \
&& echo "export LC_ALL=en_US.utf8" >> /home/vastbase/.bashrc \
&& source /home/vastbase/.bashrc \
&& cd /soft/vb/vastbase-installer/ \
&& ./vastbase_installer --silent -responseFile /soft/vb/db_install.rsp \
&& echo "host all all 192.168.22.0/24 sha256" >> /home/vastbase/data/vastbase/pg_hba.conf \
&& echo "host all all 10.10.81.0/24 sha256" >> /home/vastbase/data/vastbase/pg_hba.conf \
&& rm /soft/vb/Vastbase-G100-installer-2.2_Build15\(17408\)-kylin_v10sp2-x86_64-no_mot-20231221.tar.gz
ENTRYPOINT ["/soft/vb/docker-entrypoint.sh"]
EXPOSE 5432
2.db_install.rsp文件内容
vastbase_password=Aa123456
encryption_key=Aa123456
vastbase_home=/home/vastbase/local/vastbase
vastbase_data=/home/vastbase/data/vastbase
port=5432
max_connections=50
shared_buffers=128
db_compatibility=A
isinitdb=true
3.docker-entrypoint.sh文件内容
#!/bin/bash
set -e
whoami
ls -al /home/vastbase
source /home/vastbase/.bashrc
echo "sourced vastbase bashrc"
vb_ctl start
tail -f /dev/null
4.获取海量数据库安装包文件
参考文末网盘链接
5.将上述4个文件上传到已经装有docker的服务器的同一个目录下
6.执行构建命令
docker build -t thankwhite/vastbase_g100:2.2.15 .
7.本文所需所有文件网盘下载地址
仅供学习使用
链接:https://pan.baidu.com/s/1VoINht-X-F5i950im-6slA
提取码:2nqq
2024年10月28日更新:
由于网络问题,我现在不能把镜像推送到docker hub仓库,从官方仓库拉取镜像也有一些问题,所以把镜像导出为tar包放在百度网盘上,如有需要可以上传到服务器用docker load -i 命令导入镜像。
镜像tar包的文件名为:vastbase_g100_2.2.15_build20241027.tar
如何启动并连接数据库,请参考:
https://www.cnblogs.com/lambdadog/p/18184202