李子

harbor镜像仓库离线部署
公司要求生产环境能往容器化迁移。生产环境离线部署原则,本文所有文件已离线。环境:Centos7.5cp docke...
扫描右侧二维码阅读全文
18
2018/09

harbor镜像仓库离线部署

公司要求生产环境能往容器化迁移。

生产环境离线部署原则,本文所有文件已离线。

环境:
Centos7.5

cp docker-compose /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

tar cvzf docker.tar.gz docker/

解压后的包:
audit-libs-2.8.1-3.el7_5.1.x86_64.rpm
audit-libs-python-2.8.1-3.el7_5.1.x86_64.rpm
audit-2.8.1-3.el7_5.1.x86_64.rpm
checkpolicy-2.5-6.el7.x86_64.rpm
libcgroup-0.41-15.el7.x86_64.rpm
libsemanage-python-2.5-11.el7.x86_64.rpm
libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
policycoreutils-python-2.5-22.el7.x86_64.rpm
python-IPy-0.75-6.el7.noarch.rpm
setools-libs-3.3.8-2.el7.x86_64.rpm
docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
yum -y localinstall *.rpm
systemctl enable docker
systemctl restart docker

查看docker和docker-compose版本:
docker version
docker-compose version

harbor离线包可以去github下载最新版本,我这里已离线到fd.tn下载库。
wget http://fd.tn/work/harbor/harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz
tar xf harbor-offline-installer-v1.5.0.tgz

配置Let's Encrypt证书,这里我就直接acme了,方便快捷。
yum -y install socat
curl https://get.acme.sh | sh
sh acme.sh --issue -d reg.xxx.com --standalone
mkdir -p /opt/certs
cd ~/.acme.sh/
sh acme.sh --installcert -d reg.xxx.com --key-file /opt/certs/reg.xxx.com.key --fullchain-file /opt/certs/fullchain.cer

编译harbor配置文件:
vim harbor.cfg

域名:
hostname = reg.xxx.com
协议:
ui_url_protocol = https
证书配置:
ssl_cert = /opt/certs/fullchain.cer
ssl_cert_key = /opt/certs/reg.xxx.com.key
默认为mysql数据库方式:
db_password = 数据库密码
设置webui登录密码:
harbor_admin_password = webui管理密码

开始部署:
./install.sh

38.png

如何提交镜像到docker仓库?

docker login reg.xxx.com
docker images
docker ps
docker commit -m="fix bug" e1aba466ced8 lnmp
docker images
docker tag 98b45121ea06 reg.xxx.com/diancan/lnmp:v0.1
docker push reg.xxx.com/diancan/lnmp:v0.1

Last modification:October 11th, 2018 at 06:11 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment