首頁 > 軟體

安裝harbor作為docker映象倉庫的問題

2022-06-14 10:00:29

安裝包

docker-20.10.9.tgz

docker-compose

百度網路硬碟下載以上兩個包

連結: https://pan.baidu.com/s/1Xy6vkkxUGLmSDwrVk8ej-A 提取碼: gc8r 

docker.service 如下:

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
# 開啟遠端連線 
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

一、docker和docker-compose離線部署

1、上傳docker-20.10.9.tgz安裝包並解壓

tar  -zxvf  docker-20.10.9.tgz 
cp docker/*  /usr/bin/

2、docker.service檔案

mv docker.service /usr/lib/systemd/system/

3、啟動Docker

systemctl daemon-reload 
systemctl enable docker 
systemctl start docker 
systemctl status docker

4、docker-compose部署

cp -r docker-compose /usr/local/bin/ 
cp -r docker-compose /usr/local/sbin/ 
chmod a+x /usr/local/bin/docker-compose 
chmod a+x /usr/local/sbin/docker-compose

5、測試docker-compose

docker-compose -v

二、安裝harbor作為原生的倉庫

  Harbor是一個開源的可信雲本地註冊專案,用於儲存、簽名和掃描內容。Harbor通過新增使用者通常需要的功能(如安全性、身份和管理)擴充套件了開源Docker發行版。使登入檔更接近構建和執行環境可以提高影象傳輸效率。

1、解壓harbor-offline-installer-v2.3.0.tgz

tar xvf harbor-offline-installer-v1.9.3.tgz

2、進入harbor目錄,修改harbor.yml

cp -r harbor.yml.tmpl harbor.yml 
vi harbor.yml
複製程式碼
hostname: 192.168.4.xxx                    ##對應伺服器IP 
port: 80                                   ##對應harbor應用埠   
#  port: 443                               ##遮蔽https 
#  certificate: /your/certificate/path     ##遮蔽https 
#  private_key: /your/private/key/path     ##遮蔽https  
harbor_admin_password: llsydn123           ##harbor登入密碼,根據情況修改  

3、設定docker client,編輯/etc/docker/daemon.json

Harbor的預設安裝使用HTTP—因此,您需要將選項“-unsecure registry”新增到使用者端的Docker守護行程,並重新啟動Docker服務。

vi /etc/docker/daemon.json  {"insecure-registries" : [ "192.168.4.xxx" ] }
  • 重啟docker
service docker restart

4、安裝 Harbor

./install.sh

5、存取harbor

http://<your_harbor_host_ip

預設使用者名稱和密碼:admin/llsydn123

好了,以上就是我個人的實操了。

到此這篇關於聊聊安裝harbor作為docker映象倉庫的問題的文章就介紹到這了,更多相關docker映象倉庫harbor內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!


IT145.com E-mail:sddin#qq.com