欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Docker私有倉庫harbor的搭建步驟

 更新時間:2023年07月19日 11:35:54   作者:Linux猿  
本文主要介紹了Docker私有倉庫harbor的搭建步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

本篇文章主要介紹 Docker 私有倉庫 harbor 的搭建,搭建成功后測試鏡像的上傳和下載。

一、實驗環(huán)境

本文是在 CentOS 7.9 上進(jìn)行配置,環(huán)境如下所示。

[root@k8s-master node]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[root@k8s-master imagesJar]# docker --version
Docker version 1.13.1, build 7d71120/1.13.1
[root@k8s-master imagesJar]# docker-compose --version
docker-compose version 1.18.0, build 8dd22a9
[root@k8s-master imagesJar]#

二、安裝 harbor

2.1 安裝 docker 和 docker-compose

首先,需要在服務(wù)器上安裝 docker 和 docker-compose,執(zhí)行如下命令。

[root@k8s-master node]# yum install docker docker-compose

2.2 安裝 harbor

在服務(wù)器上執(zhí)行如下命令,下載 harbor 軟件包。

[root@k8s-master node]# wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.3.tgz

下載比較慢,可以通過迅雷下載。

解壓下載的壓縮包,執(zhí)行命令如下。

[root@k8s-master harbor]# tar zxvf harbor-offline-installer-v1.5.3.tgz

執(zhí)行命令拷貝解壓后的目錄到 /opt 目錄下,執(zhí)行命令如下所示。 

[root@k8s-master harbor]# mv harbor /opt

 進(jìn)入到 /opt/harbor 目錄下,修改文件 harbor.cfg,修改如下字段。

hostname = 192.168.231.152  # 修改 IP 地址為本機(jī) IP

 執(zhí)行如下命令,安裝 harbor。

[root@k8s-master harbor]# ./prepare
[root@k8s-master harbor]# ./install.sh

問題 1:

[node@k8s-master harbor]$ sudo ./install.sh
? Please set hostname and other necessary attributes in harbor.cfg first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.cfg bacause notary must run under https.
Please set --with-clair if needs enable Clair in Harbor
[node@k8s-master harbor]$ 

解決方法:在 harbor.cfg 配置文件中僅保留一個 hostname 字段。:

問題 2:

執(zhí)行 install.sh 腳本的時候如下報錯如下。

ERROR: for nginx  Cannot start service proxy: b'driver failed programming external connectivity on endpoint nginx (b08a457eb0d19583b0d42a53137a3e8d3a0bc89813b1def8afef7df1d85e1411): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use'
 
ERROR: for proxy  Cannot start service proxy: b'driver failed programming external connectivity on endpoint nginx (b08a457eb0d19583b0d42a53137a3e8d3a0bc89813b1def8afef7df1d85e1411): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use'
ERROR: Encountered errors while bringing up the project.

說明本機(jī) 80 端口占用了,可以

[node@k8s-master harbor]$ netstat -natp | grep 80

 查找到 80 端口對應(yīng)的進(jìn)程,通過 kill 命令停止進(jìn)程。

2.3 登錄 harbor UI 界面

在瀏覽器輸入 192.168.231.152/harbor,進(jìn)入 harbor UI 界面,如下所示。

用戶名和密碼如下所示。

用戶名:admin
密碼:Harbor12345
密碼在 /opt/harbor/harbor.cfg 中配置,默認(rèn)是 Harbor12345

 登錄后界面如下所示。

三、測試上傳和下載鏡像

先來看下 docker 的常用命令,如果想直接看測試,移步到 2.2 上傳鏡像即可。

3.1 docker 常用命令

(1)docker save

將指定鏡像打包成 tar,方便鏡像移動。

docker save -o /root/打包名.tar 鏡像名:版本號

例如:

[node@k8s-master dockerImages]$ sudo docker save -o ./demo-1.2.0.tar test/demo:1.2.0
[sudo] node 的密碼:
[node@k8s-master dockerImages]$ ls
demo-1.2.0.tar
[node@k8s-master dockerImages]$

執(zhí)行上述 docker save 命令會在當(dāng)前目錄下出現(xiàn) demo-1.2.0.tar 包,將該包復(fù)制到別的機(jī)器,執(zhí)行docker load 命令就完成 docker 鏡像的轉(zhuǎn)移了。

(2)docker load

用于載入打包好的鏡像。例如:

[node@k8s-node-1 dockerImages]$ sudo docker load -i demo-1.2.0.tar
9c742cd6c7a5: Loading layer [==================================================>] 129.2 MB/129.2 MB
03127cdb479b: Loading layer [==================================================>]  11.3 MB/11.3 MB
293d5db30c9f: Loading layer [==================================================>] 19.31 MB/19.31 MB
5c384ea5f752: Loading layer [==================================================>] 12.32 MB/12.32 MB
990c5138f5d1: Loading layer [==================================================>] 3.584 kB/3.584 kB
1aaddf64804f: Loading layer [==================================================>] 108.3 MB/108.3 MB
0a8cde955e2b: Loading layer [==================================================>] 3.584 kB/3.584 kB
0931afb63541: Loading layer [==================================================>]  16.5 MB/16.5 MB
Loaded image: test/demo:1.2.0
[node@k8s-node-1 dockerImages]$ sudo docker images
REPOSITORY                                            TAG                 IMAGE ID            CREATED             SIZE
test/demo                                             1.2.0               fff004fa39a7        11 hours ago        290 MB
docker.io/nginx                                       alpine              4937520ae206        3 weeks ago         41.4 MB
docker.io/nginx                                       latest              eb4a57159180        3 weeks ago         187 MB
registry.access.redhat.com/rhel7/pod-infrastructure   latest              99965fb98423        5 years ago         209 MB
[node@k8s-node-1 dockerImages]$

(3)docker tag

用于給鏡像打標(biāo)簽,語法格式如下所示。

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

(4)docker push

將本地的鏡像上傳到鏡像倉庫,要先登陸到鏡像倉庫。語法格式如下所示。

docker push [OPTIONS] NAME[:TAG]

3.2 上傳鏡像

(1)登錄 Harbor

首先,需要修改配置,修改 /etc/docker/daemon.json 文件,添加如下內(nèi)容。

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

其中,IP 是 Harbor 倉庫 IP。然后執(zhí)行如下命令,重啟服務(wù)。

[root@k8s-master harbor]# systemctl daemon-reload
[root@k8s-master harbor]# systemctl restart docker

然后,需要在本地的服務(wù)器(Linux 機(jī)器)上登錄,執(zhí)行如下命令登錄。

[root@k8s-master harbor]# docker login 192.168.231.152

 其中,IP 是 Harbor 倉庫的 IP,然后輸入用戶名和密碼(這里默認(rèn)用戶名:admin,密碼:Harbor12345)。 

登錄如果有問題,可以執(zhí)行如下命令嘗試,或者重啟機(jī)器。

docker-compose down -v
# 需要在 harbor 解壓包的目錄下執(zhí)行
docker-compose up -d

(2)登錄 Harbor UI 界面

登錄 Harbor UI 界面后,點擊 項目 -> library -> 推送鏡像,如下所示。

 可以看到兩條命令,第一個命令就是推送到 library 項目下的鏡像需要打 TAG 的命令,第二條命令是推送到 library 項目下鏡像的推送命令。

(3)上傳鏡像

執(zhí)行 docker tag 和 docker push 命令,將鏡像上傳到 Harbor 中,如下所示。

[root@k8s-master imagesJar]# docker tag test/demo:1.2.0 192.168.231.152/library/test:1.9.0
[root@k8s-master imagesJar]# docker push 192.168.231.152/library/test:1.9.0
The push refers to a repository [192.168.231.152/library/test]
0931afb63541: Mounted from library/demo
0a8cde955e2b: Mounted from library/demo
1aaddf64804f: Mounted from library/demo
990c5138f5d1: Mounted from library/demo
5c384ea5f752: Mounted from library/demo
293d5db30c9f: Mounted from library/demo
03127cdb479b: Mounted from library/demo
9c742cd6c7a5: Mounted from library/demo
1.9.0: digest: sha256:f864fb61dc16e5df453fcb6697418d0229871c6bb584cccdfd8662b1fd06c335 size: 2001
[root@k8s-master imagesJar]# 

在 Harbor UI 界面中可以看到對應(yīng)的鏡像。

3.3 下載鏡像

執(zhí)行如下命令拉取鏡像。

[root@k8s-master imagesJar]# docker pull 192.168.231.152/library/demo:1.8.0
Trying to pull repository 192.168.231.152/library/demo ...
1.8.0: Pulling from 192.168.231.152/library/demo
Digest: sha256:f864fb61dc16e5df453fcb6697418d0229871c6bb584cccdfd8662b1fd06c335
Status: Image is up to date for 192.168.231.152/library/demo:1.8.0
[root@k8s-master imagesJar]# 

參考鏈接:

https://www.runoob.com/docker/docker-push-command.html

https://www.cnblogs.com/pzk7788/p/10180919.html

Harbor私有鏡像倉庫離線部署-harbor 2.5.3_harbor離線部署_渡渡甲的博客-CSDN博客

Harbor安裝小坑Please set hostname and other necessary attributes in harbor.cfg first._please do not set --with-chartmuseum, as chartmusu_流年 Narcissus yu的博客-CSDN博客

報錯:ERROR: for nginx Cannot start service proxy;for proxy Cannot start service proxy;......_這閨女長得真俊啊的博客-CSDN博客

push到harbor的注意事項_error parsing http 405 response body: invalid char_阿白,的博客-CSDN博客

https://www.cnblogs.com/anxminise/p/9764221.html

到此這篇關(guān)于Docker私有倉庫harbor的搭建步驟的文章就介紹到這了,更多相關(guān)Docker harbor搭建內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • docker swarm如何在指定的node上運(yùn)行指定的容器

    docker swarm如何在指定的node上運(yùn)行指定的容器

    這篇文章主要介紹了docker swarm如何在指定的node上運(yùn)行指定的容器,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07
  • docker-compose教程之安裝使用和快速入門

    docker-compose教程之安裝使用和快速入門

    這篇文章主要介紹了docker-compose教程之安裝使用和快速入門,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • 在docker上安裝運(yùn)行mysql實例

    在docker上安裝運(yùn)行mysql實例

    Docker 使用 Google 公司推出的 Go 語言 進(jìn)行開發(fā)實現(xiàn),基于 Linux 內(nèi)核的 cgroup,namespace,以及 AUFS 類的 Union FS 等技術(shù),對進(jìn)程進(jìn)行封裝隔離,屬于操作系統(tǒng)層面的虛擬化技術(shù)。
    2017-01-01
  • 使用Docker安裝和配置 MySQL 數(shù)據(jù)庫的過程詳解

    使用Docker安裝和配置 MySQL 數(shù)據(jù)庫的過程詳解

    本文將介紹如何使用Docker來安裝和配置MySQL數(shù)據(jù)庫,以便在開發(fā)和測試環(huán)境中快速搭建MySQL實例,本文也是介紹兩種方式進(jìn)行分別是“使用鏡像安裝”、“使用Docker Compose安裝”,感興趣的朋友一起看看吧
    2023-12-12
  • Docker部署RabbitMQ鏡像的保姆級教程

    Docker部署RabbitMQ鏡像的保姆級教程

    RabbitMQ?的鏡像隊列集群(Mirrored?Queues?Cluster)是實現(xiàn)高可用性的一種模式,它通過在集群中的多個節(jié)點之間復(fù)制隊列,確保消息在集群的某些節(jié)點宕機(jī)時不會丟失,本文介紹了Docker部署RabbitMQ鏡像的保姆級教程,需要的朋友可以參考下
    2024-12-12
  • docker中mysql開啟日志的實現(xiàn)步驟

    docker中mysql開啟日志的實現(xiàn)步驟

    本文主要介紹了docker中mysql開啟日志的實現(xiàn)步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07
  • CentOS版本問題安裝Docker報錯的解決方案

    CentOS版本問題安裝Docker報錯的解決方案

    今天小編就為大家分享一篇關(guān)于CentOS版本問題安裝Docker報錯的解決方案,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-01-01
  • docker 命令報異常permission denied的解決方案

    docker 命令報異常permission denied的解決方案

    這篇文章主要介紹了docker 命令報異常permission denied的解決方案,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • Docker如何查看容器映射路徑

    Docker如何查看容器映射路徑

    這篇文章主要介紹了Docker如何查看容器映射路徑問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • docker redis5.0 cluster集群搭建的實現(xiàn)

    docker redis5.0 cluster集群搭建的實現(xiàn)

    這篇文章主要介紹了docker redis5.0 cluster集群搭建的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02

最新評論