溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Docker私服倉庫Harbor如何安裝

發布時間:2022-05-26 16:41:37 來源:億速云 閱讀:160 作者:iii 欄目:大數據

這篇文章主要介紹了Docker私服倉庫Harbor如何安裝的相關知識,內容詳細易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇Docker私服倉庫Harbor如何安裝文章都會有所收獲,下面我們一起來看看吧。

1.準備兩臺服務器

  • centos7

  • harbor 10.19.46.15

  • client 10.19.44.31

2.harbor需要安裝docker和docker-composere,client只需要安裝docker

docker安裝

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce
systemctl start docker

docker compose 安裝

docker compose 安裝
yum install epel-release
yum install -y python-pip
pip install docker-compose
yum install git

harbor1.8 下載

Docker私服倉庫Harbor如何安裝

解壓出來

[root@harbor harbor]# ll
總用量 32
-rw-r--r--. 1 root root 4519 5月 21 15:59 harbor.yml
-rwxr-xr-x. 1 root root 5088 5月 21 15:59 install.sh
-rw-r--r--. 1 root root 11347 5月 21 15:59 license
-rwxr-xr-x. 1 root root 1654 5月 21 15:59 prepare

修改harbor.yml

hostname 這里設置本機的ip

harbor_admin_password web頁面的密碼

運行

sh ./install.sh

安裝成功

......
status: downloaded newer image for goharbor/harbor-registryctl:v1.8.0
creating harbor-log ... done
creating harbor-db ... done
creating registry ... done
creating redis ... done
creating registryctl ... done
creating harbor-core ... done
creating harbor-jobservice ... done
creating harbor-portal ... done
creating nginx  ... done

? ----harbor has been installed and started successfully.----

now you should be able to visit the admin portal at http://10.19.46.15. 
for more details, please visit https://github.com/goharbor/harbor .

訪問頁面

http://10.19.46.15

Docker私服倉庫Harbor如何安裝

如果想要停止,或者是服務器重啟了,需要手動重啟,在harbor的安裝目錄,里執行命令

[root@harbor harbor]# ll
總用量 40
drwxr-xr-x. 3 root root 20 5月 22 22:24 common
-rw-r-----. 1 root root 5183 5月 22 22:24 docker-compose.yml
-rw-r--r--. 1 root root 4514 5月 22 22:23 harbor.yml
-rwxr-xr-x. 1 root root 5088 5月 21 15:59 install.sh
-rw-r--r--. 1 root root 11347 5月 21 15:59 license
-rwxr-xr-x. 1 root root 1654 5月 21 15:59 prepare

# 停止
[root@harbor harbor]# docker-compose stop
stopping nginx  ... done
stopping harbor-portal ... done
stopping harbor-jobservice ... done
stopping harbor-core ... done
stopping registryctl ... done
stopping redis  ... done
stopping registry  ... done
stopping harbor-db  ... done
stopping harbor-log ... done

# 運行
[root@harbor harbor]# docker-compose start
starting log  ... done
starting postgresql ... done
starting redis ... done
starting registry ... done
starting core ... done
starting jobservice ... done
starting portal ... done
starting proxy ... done
starting registryctl ... done

在另外一個服務器(client)登錄harbor

[root@client ~]# docker login 10.19.46.15
username: admin
password: 
error response from daemon: get https://10.19.46.15/v2/: dial tcp 10.19.46.15:443: connect: connection refused

這是因為docker1.3.2版本開始默認docker registry使用的是https,我們設置harbor默認http方式,所以當執行用docker login、pull、push等命令操作非https的docker regsitry的時就會報錯。

解決https

在harbor那臺服務器,在harbor的安裝目錄

vim docker-compose.yml

Docker私服倉庫Harbor如何安裝

然后同時編輯harbor和client的docker配置文件,10.19.46.15 是harbor的ip地址

# 1.
vim /etc/docker/daemon.json

{
 "insecure-registries": [
 "10.19.46.15"
 ]
}

# 2.添加execstart=/usr/bin/dockerd |--insecure-registry=10.19.46.15
vim /usr/lib/systemd/system/docker.service

# 把這行注釋掉,添加下面的配置 execstart=/usr/bin/dockerd -h fd:// --containerd=/run/containerd/containerd.sock
execstart=/usr/bin/dockerd
  |--insecure-registry=10.19.46.15

1.重啟harbor 的 docker-compose,命令文上有
2.重啟docker

 systemctl daemon-reload
systemctl restart docker

client 登錄倉庫

[root@client ~]# docker login 10.19.46.15 
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
login succeeded

偷工減料

pull 的命令

Docker私服倉庫Harbor如何安裝

推送和打tag的命令

Docker私服倉庫Harbor如何安裝

關于“Docker私服倉庫Harbor如何安裝”這篇文章的內容就介紹到這里,感謝各位的閱讀!相信大家對“Docker私服倉庫Harbor如何安裝”知識都有一定的了解,大家如果還想學習更多知識,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女