当前位置: 首页 » 综合知识 » it知识 » 正文

Docker私服仓库Harbor如何安装

发布时间:2023-07-22 以下文章来源于网友投稿,内容仅供参考!

1.准备两台服务器

2.harbor需要安装docker和dockerposere,client只需要安装docker

docker安装

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker/linux/centos/docker-ce.repo
yum -y install docker-ce
systemctl start docker

dockerpose 安装

docker pose 安装
yum install epel-release
yum install -y python-pip
pip install dockerpose
yum install git

harbor1.8 下载

解压出来

[root@harbor harbor]# ll
总用量 32
-rw-r--r--. 1 root root 4519 5月 21 15:59 harbor.yml
-rwxr-xr-x. 1 root root 5088 5月 21 15:59 install.sh
-rw-r--r--. 1 root root 11347 5月 21 15:59 license
-rwxr-xr-x. 1 root root 1654 5月 21 15:59 prepare

修改harbor.yml

hostname 这里设置本机的ip

harbor_admin_password web页面的密码

运行

sh ./install.sh

安装成功

......
status: downloaded newer image for goharbor/harbor-registryctl:v1.8.0
creating harbor-log ... done
creating harbor-db ... done
creating registry ... done
creating redis ... done
creating registryctl ... done
creating harbor-core ... done
creating harbor-jobservice ... done
creating harbor-portal ... done
creating nginx  ... done

 ----harbor has been installed and started successfully.----

now you should be able to visit the admin portal at 10.19.46.15. 
for more details, please visit https://github/goharbor/harbor .

访问页面

10.19.46.15

如果想要停止,或者是服务器重启了,需要手动重启,在harbor的安装目录,里执行命令

[root@harbor harbor]# ll
总用量 40
drwxr-xr-x. 3 root root 20 5月 22 22:24 mon
-rw-r-----. 1 root root 5183 5月 22 22:24 dockerpose.yml
-rw-r--r--. 1 root root 4514 5月 22 22:23 harbor.yml
-rwxr-xr-x. 1 root root 5088 5月 21 15:59 install.sh
-rw-r--r--. 1 root root 11347 5月 21 15:59 license
-rwxr-xr-x. 1 root root 1654 5月 21 15:59 prepare

# 停止
[root@harbor harbor]# dockerpose stop
stopping nginx  ... done
stopping harbor-portal ... done
stopping harbor-jobservice ... done
stopping harbor-core ... done
stopping registryctl ... done
stopping redis  ... done
stopping registry  ... done
stopping harbor-db  ... done
stopping harbor-log ... done

# 运行
[root@harbor harbor]# dockerpose start
starting log  ... done
starting postgresql ... done
starting redis ... done
starting registry ... done
starting core ... done
starting jobservice ... done
starting portal ... done
starting proxy ... done
starting registryctl ... done

在另外一个服务器(client)登录harbor

[root@client ~]# docker login 10.19.46.15
username: admin
password: 
error response from daemon: get https://10.19.46.15/v2/: dial tcp 10.19.46.15:443: connect: connection refused

这是因为docker1.3.2版本开始默认docker registry使用的是https,我们设置harbor默认http方式,所以当执行用docker login、pull、push等命令操作非https的docker regsitry的时就会报错。

解决https

在harbor那台服务器,在harbor的安装目录

vim dockerpose.yml

然后同时编辑harbor和client的docker配置文件,10.19.46.15 是harbor的ip地址

# 1.
vim /etc/docker/daemon.json

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

# 2.添加execstart=/usr/bin/dockerd |--insecure-registry=10.19.46.15
vim /usr/lib/systemd/system/docker.service

# 把这行注释掉,添加下面的配置 execstart=/usr/bin/dockerd -h fd:// --containerd=/run/containerd/containerd.sock
execstart=/usr/bin/dockerd
  |--insecure-registry=10.19.46.15

1.重启harbor 的 dockerpose,命令文上有
2.重启docker

 systemctl daemon-reload
systemctl restart docker

client 登录仓库

[root@client ~]# docker login 10.19.46.15 
username: admin
password: 
warning! your password will be stored unencrypted in /root/.docker/config.json.
configure a credential helper to remove this warning. see
https://docs.docker/engine/referencemandline/login/#credentials-store
login succeeded

偷工减料

pull 的命令

推送和打tag的命令

  • • Linux Ecdsa密钥长度选择有何依据

    在Linux

  • • Linux Khook在内核监控中的应用如何

    Linux

  • • Linux Gsoap是否支持异步通信

    GSOAP是

  • • Linux Coremail如何提升用户体验

    提升Linu

  • • Linux Ecdsa算法有哪些局限性

    ECDSA

  • 哎呀音乐钢琴键盘学习《 钢琴主人训练营》 西瓜学琴
    郭蝈 陪练钢琴 30节课时 考级刚需 让孩子每一次练琴都是高质量的
    30天轻松学会五线谱 流行钢琴自学初级教程 牙牙学琴
    流行爵士钢琴实战技巧VIP课 - 继伟 哎呀音乐
    【海上钢琴师】原版 MT1990钢琴谱
    百首经典流行钢琴实战曲集 - 继伟
    雷费尔德电钢琴重锤88键专业考级儿童初学者数码电子钢琴家用
    小练咖 真人钢琴陪练 1v1服务 2999随时退 1课时50分钟 考级刚需
    雅马哈电钢琴88键重锤CLP735智能数码电子钢琴家用专业初学者考级
    【原装进口】Yamaha/雅马哈钢琴 b121 SC2原声静音钢琴
  • 珠海专业调钢琴
  • 天津宝坻区调钢琴
  • 天津静海区钢琴调音
  • 成都简阳市钢琴调律
  • 大连瓦房店市钢琴调音
  • 眉山调钢琴联系方式
  • 惠州大亚湾钢琴调琴师
  • 长治调琴师
  • 厦门湖里区钢琴调音师
  • 上海普陀区钢琴调音师