安装支持ssl的harbor 2.1.4 docker 19.03.8 docker-compose 1.24.0

版本:

docker 19.03.8

docker-compose 1.24.0

harbor: harbor-offline-installer-v2.1.4.tgz

1、先在/root下生成证书

#生成ca根证书

bash 复制代码
openssl genrsa -out ca.key 4096

#创建ca证书

bash 复制代码
openssl req -x509 -new -nodes -sha512 -days 3650 \
 -subj "/C=CN/ST=Shenzhen/L=Shenzhen/O=Harbor/OU=Harbor/CN=harbor.rainpet.org" \
 -key ca.key \
 -out ca.crt
bash 复制代码
echo "192.168.15.6 harbor.rainpet.org" >> /etc/hosts

#生成服务器证书

bash 复制代码
openssl genrsa -out harbor.rainpet.org.key 4096

#生成csr

bash 复制代码
openssl req -sha512 -new \
    -subj "/C=CN/ST=Shenzhen/L=Shenzhen/O=Harbor/OU=Harbor/CN=harbor.rainpet.org" \
    -key harbor.rainpet.org.key \
    -out harbor.rainpet.org.csr

#生成v3文件:

bash 复制代码
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=harbor.rainpet.org
DNS.2=harbor.rainpet
DNS.3=harbor
EOF

#生成csr证书

bash 复制代码
openssl x509 -req -sha512 -days 3650 \
    -extfile v3.ext \
    -CA ca.crt -CAkey ca.key -CAcreateserial \
    -in harbor.rainpet.org.csr \
    -out harbor.rainpet.org.crt

复制证书:

bash 复制代码
mkdir /app/cert
cp harbor.rainpet.org.crt /app/cert
cp harbor.rainpet.org.key /app/cert

#生成cert证书

bash 复制代码
openssl x509 -inform PEM -in harbor.rainpet.org.crt -out harbor.rainpet.org.cert
合并生成pem
cat harbor.rainpet.org.crt harbor.rainpet.org.key > harbor.rainpet.org.pem

复制文件

bash 复制代码
mkdir -p /etc/docker/certs.d/harbor.rainpet.org
cp harbor.rainpet.org.cert /etc/docker/certs.d/harbor.rainpet.org
cp harbor.rainpet.org.key /etc/docker/certs.d/harbor.rainpet.org
cp ca.crt /etc/docker/certs.d/harbor.rainpet.org

重启docker

bash 复制代码
systemctl restart docker

安装harbor,前提要安装好docker。

bash 复制代码
cd /app/src/
cp docker-compose /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
docker-compose -v
tar zxvf harbor-offline-installer-v2.1.4.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml

修改harbor.yml文件:

nano harbor.yml

bash 复制代码
hostname: reg.mydomain.com修改为 harbor.rainpet.org
https:下
  certificate: /your/certificate/path
  private_key: /your/private/key/path
修改为:
  certificate: /root/harbor.rainpet.org.crt
  private_key: /root/harbor.rainpet.org.key
harbor_admin_password: Harbor12345 默认密码 可以更改
port: 80 修改为8080 如果不冲突不用改

加载镜像:

bash 复制代码
docker load -i harbor.v2.1.4.tar.gz

设置环境:

bash 复制代码
./prepare

安装

bash 复制代码
./install.sh

启动服务及停止服务

bash 复制代码
docker-compose down
docker-compose up -d
相关推荐
FPGA_Linuxer3 天前
FPGA 40 DAC线缆和光模块带光纤实现40G UDP差异
网络协议·fpga开发·udp
real 13 天前
传输层协议UDP
网络·网络协议·udp
hsjkdhs3 天前
网络编程之UDP广播与粘包问题
网络·网络协议·udp
yzx9910133 天前
接口协议全解析:从HTTP到gRPC,如何选择适合你的通信方案?
网络·人工智能·网络协议·flask·pygame
板鸭〈小号〉3 天前
UDP-Server(3)chat聊天室
网络·网络协议·udp
weixin_456904273 天前
使用HTTPS 服务在浏览器端使用摄像头的方式解析
网络协议·http·https
疯狂的维修3 天前
关于Gateway configration studio软件配置网关
网络协议·c#·自动化·gateway
wow_DG3 天前
【WebSocket✨】入门之旅(五):WebSocket 的安全性
网络·websocket·网络协议
拷贝码农卡卡东4 天前
pre-commit run --all-files 报错:http.client.RemoteDisconnected
网络·网络协议·http