下载地址:https://github.com/goharbor/harbor/releases
下载地址:Releases · docker/compose · GitHub
上传docker compose安装包,移至/usr/local/bin并命名为docker-compose:
对二进制文件应用可执行权限:
chmod +x /usr/local/bin/docker-compose
查看版本:
openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=test.harbor.com" \
-key ca.key \
-out ca.crt
openssl genrsa -out test.harbor.com.key 4096
openssl req -sha512 -new \
-subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=test.harbor.com" \
-key test.harbor.com.key \
-out test.harbor.com.csr
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=test.harbor.com
DNS.2=test.harbor
DNS.3=test
EOF
openssl x509 -req -sha512 -days 3650 \
-extfile v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in test.harbor.com.csr \
-out test.harbor.com.crt
cp test.harbor.com.crt /data/cert/
cp test.harbor.com.key /data/cert/
openssl x509 -inform PEM -in test.harbor.com.crt -out test.harbor.com.cert
mkdir -p /etc/docker/certs.d/test.harbor.com/
cp test.harbor.com.cert /etc/docker/certs.d/test.harbor.com/
cp test.harbor.com.key /etc/docker/certs.d/test.harbor.com/
cp ca.crt /etc/docker/certs.d/test.harbor.com/
systemctl restart docker
tar xzvf harbor-offline-installer-v2.5.0.tg
vi harbor.yaml
修改主机名、证书路径:
安装:
./install.sh
ifconfig查看本地网口后配置:
docker login验证:
网页登陆验证:
推送镜像验证:
如需修改配置,要先关闭harbor,后修改配置文件,然后执行./prepare使其生效,最后启动harbor即可:
停止:在harbor目录下执行docker-compose down -v
启动:在harbor目录下执行docker-compose up -d