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
![](http://static.javashuo.com/static/loading.gif)
說明
- 前文Centos7搭建Harbor私有倉庫(二)中,咱們以https方式搭建了Harbor,本篇咱們主要配置Docker以https方式訪問Harbor私有倉庫
2 Docker配置
2.1 Mac系統
2.1.1 配置Docker
Mac系統中只需配置Proferences -> Proxies
使用System Proxy
便可,以下:
![](http://static.javashuo.com/static/loading.gif)
2.1.2 登陸私服驗證
docker login registry.anxminise.cc #登陸私服
![](http://static.javashuo.com/static/loading.gif)
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
目錄中,以下:
![](http://static.javashuo.com/static/loading.gif)
重啓docker:
登陸registry.anxminise.cc
私服倉庫:
docker login registry.anxminise.cc
![](http://static.javashuo.com/static/loading.gif)