日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用

1.Harbor簡介
Harbor是由VMWare公司開源的容器鏡像倉庫。事實(shí)上,Harbor是在Docker Registry上進(jìn)行了相應(yīng)的企業(yè)級(jí)擴(kuò)展,從而獲得了更加廣泛的應(yīng)用,這些新的企業(yè)級(jí)特性包括:管理用戶界面,基于角色的訪問控制,AD/LDAP集成以及審計(jì)日志等,足以滿足基本企業(yè)需求。
2.安裝docker-ce
1)安裝依賴包
[root@harbor opt]# yum install -y yum-utils device-mapper-persistent-data lvm2
2)下載docker-ce 倉庫
[root@harbor opt]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
官方比較慢的話,可以使用阿里云的docker-ce.repo
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3)更新倉庫
yum repolist 或者 yum makecache fast
4)安裝docker-ce
[root@harbor opt]# yum install docker-ce -y
5)配置加速并啟動(dòng)
[root@harbor opt]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
[root@harbor opt]# systemctl start docker
6) 確認(rèn)安裝完成
[root@harbor opt]# docker version
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
3.安裝docker-compose
第一種方式:yum 安裝
[root@harbor opt]# yum install docker-compose -y
第二種方式:下載可執(zhí)行文件:
[root@harbor opt]# curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
[root@harbor opt]# chmod +x /usr/local/bin/docker-compose
確認(rèn)安裝完成:
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
4.安裝harbor
[root@harbor opt]# cd /opt
[root@harbor opt]# wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.6.1.tgz
[root@harbor opt]# tar -xf harbor-offline-installer-v1.6.1.tgz
[root@harbor opt]# cd harbor/
[root@harbor opt]# vim harbor.cfg
hostname = reg.slito.com \harbor的服務(wù)地址(ip或者域名)
ui_url_protocol = http \選擇http方式
harbor_admin_password = 123456 \harbor web訪問的密碼
[root@harbor harbor]# ./prepare \加載配置
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
[root@harbor harbor]# ./install.sh \安裝harbor
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
安裝完成后,提示通過“ http://reg.slito.com” 訪問harbor,用戶名是admin,密碼是之前設(shè)置的123456
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
5.上傳鏡像到harbor倉庫
在本機(jī)配置harbor倉庫http可信
/etc/docker/daemon.json中添加“"insecure-registries":["reg.slito.com"]”,重啟docker
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
不然會(huì)報(bào)錯(cuò),默認(rèn)是走h(yuǎn)ttps的
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
在node1上登錄harbor倉庫,上傳/下載鏡像
[root@node1 ~]# docker login reg.slito.com
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

創(chuàng)新互聯(lián)建站專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站建設(shè)、成都做網(wǎng)站、隴縣網(wǎng)絡(luò)推廣、微信小程序、隴縣網(wǎng)絡(luò)營銷、隴縣企業(yè)策劃、隴縣品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)建站為所有大學(xué)生創(chuàng)業(yè)者提供隴縣建站搭建服務(wù),24小時(shí)服務(wù)熱線:028-86922220,官方網(wǎng)址:www.cdcxhl.com

Login Succeeded
[root@node1 ~]# docker tag busybox reg.slito.com/library/busybox:v1
[root@node1 ~]# docker push reg.slito.com/library/busybox:v1
The push refers to repository [reg.slito.com/library/busybox]
8a788232037e: Pushed
v1: digest: sha256:915f390a8912e16d4beb8689720a17348f3f6d1a7b659697df850ab625ea29d5 size: 527
[root@node1 ~]#
在harbor中查看
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
6.下載harbor中的鏡像
先刪掉原來的鏡像
[root@node1 ~]# docker rmi reg.slito.com/library/busybox:v1
重新從harbor pull
[root@node1 ~]# docker pull reg.slito.com/library/busybox:v1
確認(rèn)
[root@node1 ~]# docker images | grep busybox
reg.slito.com/library/busybox v1 59788edf1f3e 8 weeks ago 1.15MB

7.配置https訪問
1) 安裝openssl
#yum install openssl -y
2) 創(chuàng)建證書的database文件index.txt和序列文件serial
[root@harbor opt]# touch /etc/pki/CA/index.txt
[root@harbor opt]# echo "01" > /etc/pki/CA/serial
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用

3) 創(chuàng)建私鑰,生成自簽證書(用于發(fā)放給個(gè)人用戶)
#(umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem)
#openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
4) 客戶端生成證書請(qǐng)求(.csr)
#cd /opt/harbor
#mkdir ssl
#cd ssl
#(umask 077;openssl genrsa -out reg.slito.com.key) \生成私鑰
#openssl req -new -key reg.slito.com.key -out reg.slito.com.csr \ 生成證書請(qǐng)求
和上面cacert.pem生成時(shí)寫的結(jié)果保持一致
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
5) 簽發(fā)證書(本機(jī)是CA同時(shí)又是申請(qǐng)證書的客戶端)
#cd /opt/harbor/ssl
#openssl ca -in reg.slito.com.csr -out reg.slito.com.crt -days 365
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
6) 修改配置文件,重新啟動(dòng)harbor
#cd /opt/harbor
#docker-compose down -v
#vim harbor.cfg
ui_url_protocol = https
ssl_cert = ./ssl/reg.slito.com.crt
ssl_cert_key = ./ssl/cert/reg.slito.com.key
secretkey_path = ./ssl/
#./prepare
#./install.sh
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
訪問“https://reg.slito.com”
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
7) 其他主機(jī)訪問harbor,pull/push鏡像設(shè)置
拷貝reg.slito.com.crt到需要訪問harbor倉庫的主機(jī)上(/etc/docker/certs.d/reg.slito.com/),目標(biāo)主機(jī)不用配置信任就可以直接訪問。
#cp /opt/harbor/ssl/reg.slito.com.crt /etc/docker/certs.d/reg.slito.com/
企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用

其他:關(guān)于https訪問,可以看另一篇博客https://blog.51cto.com/slitobo/1931603


名稱欄目:企業(yè)級(jí)鏡像倉庫harbor搭建(http/https)及使用
文章地址:http://www.dlmjj.cn/article/gdhgjp.html