参考网址: 你必须知道的Docker镜像仓库的搭建 - EdisonZhou - 博客园
(25上 /home/huangzg/registry 有 docker-compose-linux-x86_64 和 harbor-offline-installer-v2.3.4.tgz 和 harbor/harbor.yml
正在上传…重新上传取消
)
下载
root 用户(实际安装的过程中,不使用root用户 执行 install.sh时启动失败)
wget https://github.com/goharbor/harbor/releases/download/v2.3.4/harbor-offline-installer-v2.3.4.tgz
wget https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose; chmod +x /usr/local/bin/docker-compose
openssl genrsa -out test.com.key 4096
openssl req -x509 -new -nodes -sha512 -days 36500 \
-subj "/C=TW/ST=Taipei/L=Taipei/O=example/OU=Personal/CN=test.com" \
-key test.com.key \
-out test.com.crt
tar zxvf harbor-offline-installer-v2.3.4.tgz
cd harbor
vim harbor.yml.tmpl
hostname: 10.0.1.25:9999
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 9999
https:
# https port for harbor, default is 443
#port: 443
# The path of cert and key files for nginx
#certificate: /your/certificate/path
#private_key: /your/private/key/path
data_volume: /home/huangzg/registry/harbor
https:
# https port for harbor, default is 443
port: 4433
# The path of cert and key files for nginx
certificate: /home/huangzg/registry/harbor/key_and_crt_file/10.0.1.25:9999.crt
private_key: /home/huangzg/registry/harbor/key_and_crt_file/10.0.1.25:9999.key
mv harbor.yml.tmpl harbor.yml
./prepare
./install.sh
web访问: https://10.0.1.25:4433 admin/Harbor12345
windows
C:\WINDOWS\system32\drivers\etc\hosts -> 10.0.1.25 test.com -》 ipconfig /flushdns -> https://test.com:4433
linux 客户端
mkdir -p /etc/docker/certs.d/test.com -> sz test.com.crt
vim /etc/hosts -》 10.0.1.25 test.com
vim /usr/lib/systemd/system/docker.service -》ExecStart 后面加上 https://test.com:4433
(http 方式 (vim /etc/docker/daemon.json http方式需要修改,加上 "insecure-registries" : [ "test.com:9999" ]))
systemctl daemon-reload;systemctl restart docker
237上操作
docker login https://test.com:4433 -u huangzg -p Huang12345 或者 docker login https://test.com:4433 -u admin -p Harbor12345
docker tag ubuntu:16.04 test.com:4433/test/ubuntu:16.04
docker push test.com:4433/test/ubuntu:16.04
正在上传…重新上传取消
正在上传…重新上传取消
重启
$ docker-compose down $ ./prepare $ docker-compose up –d
api使用
查看版本: curl https://test.com:4433/api/version -k
查看项目: curl -u admin:Harbor12345 https://test.com:4433/api/v2.0/projects -k