Harbor镜像仓库介绍与安装

Harbor镜像仓库介绍与安装(制作自定义镜像) 注意:registry 是docker官方制作镜像工具

[root@192 ~]# cd /usr/local/
[root@192 local]# ls
bin  docker  etc  games  gitTest  harbor-offline-installer-v2.10.1.tgz  include  lib  lib64  libexec  sbin  share  src  test
[root@192 local]# tar -zxvf harbor-offline-installer-v2.10.1.tgz 
harbor/harbor.v2.10.1.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
[root@192 local]# ls
bin  docker  etc  games  gitTest  harbor  harbor-offline-installer-v2.10.1.tgz  include  lib  lib64  libexec  sbin  share  src  test
[root@192 local]# cd harbor/
[root@192 harbor]# ls
common.sh  harbor.v2.10.1.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@192 harbor]# cd ..
[root@192 local]# rm -rf harbor-offline-installer-v2.10.1.tgz 
[root@192 local]# ls
bin  docker  etc  games  gitTest  harbor  include  lib  lib64  libexec  sbin  share  src  test
[root@192 local]# cd harbor/
[root@192 harbor]# ls
common.sh  harbor.v2.10.1.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@192 harbor]# 
root@192 harbor]# cp harbor.yml.tmpl harbor.yml
[root@192 harbor]# ls
common.sh  harbor.v2.10.1.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@192 harbor]# vim harbor.yml
[root@192 harbor]# ./install.sh 

1616a81e292de9def62fb4734589f771.png
harbor地址/项目名/镜像名:版本

[root@192 harbor]# vim /etc/docker/daemon.json

{
  "insecure-registries" : ["192.168.63.128:80"]
}

[root@192 harbor]# docker tag 1d9ebe4625f8 192.168.63.128:80/repo/mytest:v1.0.0
[root@192 harbor]# docker push 192.168.63.128:80/repo/mytest:v1.0.0
[root@192 harbor]# systemctl restart docker
[root@192 docker]# docker push 192.168.63.128:80/repo/mytest:v1.0.0
The push refers to repository [192.168.63.128:80/repo/mytest]
5f70bf18a086: Preparing 
e604813a944a: Preparing 
50ecdabc71b7: Preparing 
3e9cda2eceec: Preparing 
bb7b60f93aea: Preparing 
0ef3d186e2bd: Waiting 
1e0931f30489: Waiting 
fd97e4a10f39: Waiting 
unauthorized: unauthorized to access repository: repo/mytest, action: push: unauthorized to access repository: repo/mytest, action: push
[root@192 ~]# docker login -u admin -p Harbor12345 192.168.63.128:80
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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
[root@192 ~]# docker push 192.168.63.128:80/repo/mytest:v1.0.0
The push refers to repository [192.168.63.128:80/repo/mytest]
5f70bf18a086: Pushed 
e604813a944a: Pushed 
50ecdabc71b7: Pushed 
3e9cda2eceec: Pushed 
bb7b60f93aea: Pushed 
0ef3d186e2bd: Pushed 
1e0931f30489: Pushed 
fd97e4a10f39: Pushed 
v1.0.0: digest: sha256:10dd80fbd6101c124892401c7f2caae99d28fb1d29b3e93a08325cd78ecc2546 size: 3032
[root@192 ~]# 
[root@192 ~]# docker pull 192.168.63.128:80/repo/mytest:v1.0.0

Jenkins容器内部使用Docker

[root@192 ~]# cd /var/run/
[root@192 run]# ll
总用量 60
drwxr-xr-x.  2 root           root            100 3月  26 06:49 abrt
-rw-------.  1 root           root             11 3月  26 06:49 alsactl.pid
-rw-r--r--.  1 root           root              4 3月  26 06:49 atd.pid
-rw-r--r--.  1 root           root              4 3月  26 06:49 auditd.pid
drwxr-xr-x.  2 avahi          avahi            80 3月  26 06:49 avahi-daemon
drwxr-xr-x.  2 root           root             40 3月  26 06:49 certmonger
drwxr-x---.  2 chrony         chrony           60 3月  26 07:42 chrony
-rw-r--r--.  1 root           root              4 3月  26 06:49 chronyd.pid
drwxr-xr-x.  2 root           root             80 3月  26 06:50 console
drwx--x--x.  5 root           root            140 3月  26 07:10 containerd
-rw-r--r--.  1 root           root              4 3月  26 06:49 crond.pid
----------.  1 root           root              0 3月  26 06:49 cron.reboot
drwxr-xr-x.  3 root           lp               80 3月  26 06:49 cups
drwxr-xr-x.  2 root           root             60 3月  26 06:49 dbus
-rw-r--r--.  1 root           root              4 3月  26 07:42 dhclient-ens33.pid
prw-------.  1 root           root              0 3月  26 06:49 dmeventd-client
prw-------.  1 root           root              0 3月  26 06:49 dmeventd-server
drwx------.  8 root           root            180 3月  26 07:36 docker
-rw-r--r--.  1 root           root              5 3月  26 07:36 docker.pid
srw-rw----.  1 root           docker            0 3月  26 06:49 docker.sock
-rw-------.  1 root           root              0 3月  26 06:49 ebtables.lock
drwxr-xr-x.  2 root           root             40 3月  26 06:49 faillock
drwx--x--x.  4 root           gdm             100 3月  26 06:50 gdm
-rw-------.  1 root           root              4 3月  26 06:49 gssproxy.pid
srw-rw-rw-.  1 root           root              0 3月  26 06:49 gssproxy.sock
drwxr-xr-x.  4 root           root            100 3月  26 06:49 initramfs
-rw-r--r--.  1 root           root              4 3月  26 06:49 ksmtune.pid
drwxr-xr-x.  6 root           root            220 3月  26 06:49 libvirt
-rw-r--r--.  1 root           root              3 3月  26 06:49 libvirtd.pid
drwxr-xr-x.  8 root           root            220 3月  26 07:08 lock
drwxr-xr-x.  3 root           root             60 3月  26 06:49 log
drwxrwxr-x.  3 root           libstoragemgmt   60 3月  26 06:49 lsm
drwx------.  2 root           root             80 3月  26 06:49 lvm
-rw-r--r--.  1 root           root              4 3月  26 06:49 lvmetad.pid
drwx--x---.  2 root           root             40 3月  26 06:49 mdadm
drwxr-xr-x.  2 root           root             40 3月  26 06:49 mount
drwxrwxr-x.  2 root           root             40 3月  26 06:49 netreport
drwxr-xr-x.  3 root           root            100 3月  26 06:49 NetworkManager
drwxr-xr-x.  2 root           root             40 3月  26 06:50 plymouth
drwxr-xr-x.  2 root           root             40 3月  26 06:49 ppp
drwxr-xr-x.  2 radvd          radvd            40 3月  26 06:49 radvd
drwx------.  2 rpc            rpc              40 3月  26 06:49 rpcbind
-r--r--r--.  1 root           root              0 3月  26 06:49 rpcbind.lock
srw-rw-rw-.  1 root           root              0 3月  26 06:49 rpcbind.sock
drwxr-xr-x.  2 root           root             40 3月  26 06:49 samba
drwxr-xr-x.  2 root           root             40 3月  26 06:49 sepermit
drwxr-xr-x.  2 root           root             40 3月  26 06:49 setrans
drwx--x--x.  2 setroubleshoot setroubleshoot   40 3月  26 06:49 setroubleshoot
-rw-------.  1 root           root              4 3月  26 06:49 sm-notify.pid
drwxr-xr-x.  2 root           root             60 3月  26 06:49 spice-vdagentd
-rw-r--r--.  1 root           root              4 3月  26 06:49 sshd.pid
drwx--x--x.  3 root           root             60 3月  26 06:49 sudo
drwxr-xr-x.  2 root           root             60 3月  26 06:49 sysconfig
-rw-------.  1 root           root              3 3月  26 06:49 syslogd.pid
drwxr-xr-x. 17 root           root            420 3月  26 07:29 systemd
drwxr-xr-x.  2 root           root             60 3月  26 06:49 tmpfiles.d
drwxr-xr-x.  2 root           root             60 3月  26 06:49 tuned
drwxr-xr-x.  7 root           root            160 3月  26 07:36 udev
drwx------.  2 root           root             40 3月  26 06:49 udisks2
drwxr-xr-x.  4 root           root             80 3月  26 07:38 user
-rw-rw-r--.  1 root           utmp           1920 3月  26 07:38 utmp
drwxr-xr-x.  2 root           root             60 3月  26 06:49 vmware
-rw-------.  1 root           root              0 3月  26 06:49 xtables.lock
[root@192 run]# chown root:root docker.sock
[root@192 run]# chmod o+rw docker.sock 
[root@192 run]# cd /usr/local/docker/jenkins_docker/
[root@192 jenkins_docker]# ls
data  docker-compose.yml
[root@192 jenkins_docker]# vim docker-compose.yml 
[root@192 jenkins_docker]# docker-compose up -d
[+] Running 1/1
 ✔ Container jenkins  Started                                                                                                                     0.1s 
[root@192 jenkins_docker]# docker exec -it jenkins bash
jenkins@c4f0dc7b5532:/$ docker version
Client: Docker Engine - Community
 Version:           25.0.4
 API version:       1.44
 Go version:        go1.21.8
 Git commit:        1a576c5
 Built:             Wed Mar  6 16:33:16 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.4
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       061aa95
  Built:            Wed Mar  6 16:32:11 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
jenkins@c4f0dc7b5532:/$ 

目标服务器准备脚本文件

82c5ea5148da706bbab4913bc068e2e5.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,406评论 6 503
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,732评论 3 393
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,711评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,380评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,432评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,301评论 1 301
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,145评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,008评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,443评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,649评论 3 334
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,795评论 1 347
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,501评论 5 345
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,119评论 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,731评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,865评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,899评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,724评论 2 354

推荐阅读更多精彩内容