git clone https://github.com/Fishdrowned/ssl.git #将项目下载到本地
.
├── LICENSE
├── README.md
├── ca.cnf
├── docs
│ ├── chrome-certs-details.png
│ ├── chrome-certs-ok.png
│ ├── chrome-settings-certs-imported.png
│ ├── chrome-settings-certs.png
│ ├── chrome-trust.md
│ └── output.png
├── flush.sh
├── gen.cert.sh
└── gen.root.sh
./gen.cert.sh registry.anxminise.cc #生成registry.anxminise.cc域名的证书
.
├── 20181011-0710
│ ├── registry.anxminise.cc.bundle.crt
│ ├── registry.anxminise.cc.crt
│ └── registry.anxminise.cc.csr.pem
├── registry.anxminise.cc.bundle.crt -> ./20181011-0710/registry.anxminise.cc.bundle.crt
├── registry.anxminise.cc.crt -> ./20181011-0710/registry.anxminise.cc.crt
├── registry.anxminise.cc.key.pem -> ../cert.key.pem
└── root.crt -> ../root.crt
mkdir -p /data/cert建立证书存放目录
mv registry.anxminise.cc.crt /data/cert/server.crt #将证书放到Harbor配置目录下
mv registry.anxminise.cc.key.pem /data/cert/server.key #将秘钥放到Harbor配置目录下
ll /data/cert #查看目录内容
cd /opt/harbor #进入到harbor目录
vim harbor.cfg #编辑harbor的配置文件
hostname = registry.anxminise.cc #配置harbor服务器的域名
ui_url_protocol = https #配置https方式启动
./prepare #从新配置Harbor
./install.sh #从新执行Harbor安装,注:此处可能有更好的方式重启
cat /etc/hosts
192.168.1.112 registry.anxminise.cc
docker login 192.168.1.112
3.1.1 配置Docker
在/etc/docker
新建daemon.json
文件:
mkdir -p /etc/docker #新建docker目录
vim /etc/docker/daemon.json #新建daemon.json文件
编辑内容以下:
{ "insecure-registries":["192.168.1.112"] }
重启docker
3.1.2 登陆私有仓库进行验证
docker login 192.168.1.112

说明
- 前文Centos7搭建Harbor私有仓库(二)中,咱们以https方式搭建了Harbor,本篇咱们主要配置Docker以https方式访问Harbor私有仓库
2 Docker配置
2.1 Mac系统
2.1.1 配置Docker
Mac系统中只需配置Proferences -> Proxies
使用System Proxy
便可,以下:

2.1.2 登陆私服验证
docker login registry.anxminise.cc #登陆私服

2.2 Windows系统
待补充
2.3 Linux系统
2.3.1 配置registry.anxminise.cc域名
编辑/etc/hosts
:
文件最后部分,加入以下:
192.168.1.112 registry.anxminise.cc
2.3.2 配置Docker
在/etc/docker/certs.d
目录下新建registry.anxminise.cc
目录,
mkdir -p /etc/docker/certs.d/registry.anxminise.cc
将https://github.com/Fishdrowned/ssl自签名生成的根证书,即out
目录下的root.crt
证书放到registry.anxminise.cc
目录中,以下:

重启docker:
登陆registry.anxminise.cc
私服仓库:
docker login registry.anxminise.cc
