美文网首页
Harbor镜像仓库介绍与安装

Harbor镜像仓库介绍与安装

作者: 灯火楼台666 | 来源:发表于2024-03-25 23:37 被阅读0次

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

相关文章

  • Harbor实战

    Harbor的介绍不多说 本次记录harbor创建laravel项目实现镜像管理过程 一、Harbor的安装与配置...

  • Harbor私有镜像仓库部署

    Harbor是由 VMWare 公司开源的容器镜像仓库。Harbor内容包括: 镜像仓库权限控制 镜像远程同步复制...

  • Docker 镜像仓库安装

    Docker镜像仓库比较多,通用的有github、harbor等,这里我们安装私有的简单仓库 registry,主...

  • 搭建harbor私有镜像仓库(一)

    搭建harbor私有镜像仓库(一) 背景: 最近接收到新任务 需要在公司内部部署一个harbor仓库 我这里介绍的...

  • 搭建harbor私有镜像仓库(二)

    搭建harbor私有镜像仓库(二) 背景: 最近接收到新任务 需要在公司内部部署一个harbor仓库 我这里介绍的...

  • Docker搭建私有仓库之Harbor

    Docker搭建私有仓库之Harbor Harbor Harbor是构建企业级私有docker镜像的仓库的开源解决...

  • Docker 镜像仓库 Harbor 部署

    Harbor 功能官方介绍: 基于角色的访问控制:用户与 Docker 镜像仓库通过“项目”进行组织管理,一个用户...

  • Harbor介绍

    Harbor介绍 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然docker官方提供了公共的镜像仓库(...

  • Harbor镜像删除回收

    Harbor镜像删除回收 问题原因 Harbor私有仓库运行一段时间后,仓库中存有大量镜像,会占用太多的存储空间。...

  • docker仓库 harbor

    docker仓库 Harbor 修改docker仓库地址 安装docker-compose 下载harbor 修改...

网友评论

      本文标题:Harbor镜像仓库介绍与安装

      本文链接:https://www.haomeiwen.com/subject/yxujtjtx.html