1. 首页
  2. 技术知识

安装harbor作为docker镜像仓库的问题

目录

    一、docker和docker-compose离线部署

      1、上传docker-20.10.9.tgz安装包并解压2、docker.service文件3、启动Docker4、docker-compose部署5、测试docker-compose

    二、安装harbor作为本地的仓库

      1、解压harbor-offline-installer-v2.3.0.tgz2、进入harbor目录,修改harbor.yml3、配置docker client,编辑/etc/docker/daemon.json4、安装 Harbor5、访问harbor


安装包

docker-20.10.9.tgz

docker-compose

百度网盘下载以上两个包

链接: https://pan.baidu.com/s/1Xy6vkkxUGLmSDwrVk8ej-A 提取码: gc8r

docker.service 如下:

  1. [Unit]
  2. Description=Docker APPlication Container Engine
  3. Documentation=https://docs.docker.com
  4. After=network-online.target firewalld.service
  5. Wants=network-online.target
  6. [Service]
  7. Type=notify
  8. # the default is not to use systemd for cgroups because the delegate issues still
  9. # exists and systemd currently does not support the cgroup feature set required
  10. # for containers run by docker
  11. # 开启远程连接
  12. ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
  13. ExecReload=/bin/kill -s HUP $MAINPID
  14. # Having non-zero Limit*s causes performance problems due to accounting overhead
  15. # in the kernel. We recommend using cgroups to do container-local accounting.
  16. LimitNOFILE=infinity
  17. LimitNPROC=infinity
  18. LimitCORE=infinity
  19. # Uncomment TasksMax if your systemd version supports it.
  20. # Only systemd 226 and above support this version.
  21. #TasksMax=infinity
  22. TimeoutStartSec=0
  23. # set delegate yes so that systemd does not reset the cgroups of docker containers
  24. Delegate=yes
  25. # kill only the docker process, not all processes in the cgroup
  26. KillMode=process
  27. # restart the docker process if it exits prematurely
  28. Restart=on-failure
  29. StartLimitBurst=3
  30. StartLimitInterval=60s
  31. [Install]
  32. WantedBy=multi-user.target

复制代码
一、docker和docker-compose离线部署


1、上传docker-20.10.9.tgz安装包并解压

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

复制代码
2、docker.service文件

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

复制代码
3、启动Docker

  1. systemctl daemon-reload
  2. systemctl enable docker
  3. systemctl start docker
  4. systemctl status docker

复制代码
4、docker-compose部署

  1. cp -r docker-compose /usr/local/bin/
  2. cp -r docker-compose /usr/local/sbin/
  3. chmod a+x /usr/local/bin/docker-compose
  4. chmod a+x /usr/local/sbin/docker-compose

复制代码
5、测试docker-compose

  1. docker-compose -v

复制代码
二、安装harbor作为本地的仓库

  Harbor是一个开源的可信云本地注册项目,用于存储、签名和扫描内容。Harbor通过添加用户通常需要的功能(如安全性、身份和管理)扩展了开源Docker发行版。使注册表更接近构建和运行环境可以提高图像传输效率。

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

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

复制代码
2、进入harbor目录,修改harbor.yml

  1. cp -r harbor.yml.tmpl harbor.yml
  2. vi harbor.yml
  3. 复制代码

复制代码

  1. hostname: 192.168.4.xxx                    ##对应服务器IP
  2. port: 80                                   ##对应harbor应用端口   
  3. #  port: 443                               ##屏蔽https
  4. #  certificate: /your/certificate/path     ##屏蔽https
  5. #  private_key: /your/private/key/path     ##屏蔽https  
  6. harbor_admin_password: llsydn123           ##harbor登录密码,根据情况修改  

复制代码
3、配置docker client,编辑/etc/docker/daemon.json

Harbor的默认安装使用HTTP—因此,您需要将选项“-unsecure registry”添加到客户端的Docker守护进程,并重新启动Docker服务。

  1. vi /etc/docker/daemon.json  {“insecure-registries” : [ “192.168.4.xxx” ] }

复制代码

    重启docker

  1. service docker restart

复制代码
4、安装 Harbor

  1. ./install.sh

复制代码
安装harbor作为docker镜像仓库的问题


5、访问harbor

http://<your_harbor_host_ip

默认用户名和密码:admin/llsydn123

好了,以上就是我个人的实操了。

到此这篇关于聊聊安装harbor作为docker镜像仓库的问题的文章就介绍到这了,更多相关docker镜像仓库harbor内容请搜索软件技术网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件技术网!

原创文章,作者:starterknow,如若转载,请注明出处:https://www.starterknow.com/108960.html

联系我们