harbor

官网

harbor部署
1、系统版本
[root@test1 ~]# uname -a
Linux test1 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@test1 ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)

2、docker安装

3、安装docker-compose(Harbor是通过docker compose来部署的)
 1)配置阿里的epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

 2)安装并升级Python-pip
yum install python-pip -y
pip install --upgrade pip

 3)安装docker-compose
pip install docker-compose
docker-compose -v

下载harbor安装包
1)可以在网站上下载离线安装包
地址:https://github.com/goharbor/harbor/releases
harbor-offline-installer-v2.0.2.tgz
2)国内harbor离线版镜像(版本可能不是最新,下载速度较快)
http://harbor.orientsoft.cn/

这里我用国内的网站下载包
http://harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz
tar -zxvf harbor-offline-installer-v1.5.0.tgz && cd harbor
注:解压offline包后进去harbor目录,里面的harbor.v1.5.0.tar.gz 里就是 Harbor用到的镜像

编辑配置文件
vim harbor.cfg
    hostname = 172.16.186.139           #写你自己的网址或IP,公网访问要写公网IP
    customize_crt = false                 #支持Http 访问

运行 && 安装
./prepare && ./install.sh

 

运行成功后使用 docker ps 查看,可以看到服务已经起来了

常用管理命令
    开始服务: docker-compose start
    停止服务: docker-compose stop

web访问
http://172.16.186.139    (admin/Harbor12345)
新建一个项目,命名为 opop,并设置访问级别为公开。

注:这里的项目就是一私有化的Docker镜像仓库。

 

上传镜像
1. 修改Docker配置
docker 默认是按 https 请求的,由于我搭的私有库是 http 的,所以需要修改 docker 配置,将信任的库的地址写上
vim /etc/docker/daemon.json
{
  "insecure-registries": [
    "172.16.186.139"
  ]
}

 

重启docker使之生效
systemctl restart docker

2. 制作镜像
将 nginx 制作成一个私有镜像, nginx是我从 docker hub 上拉取的镜像。
docker pull nginx

对镜像打标签

注:这里因为我是pull的nginx,所以在对容器打好标签后一定要将nginx删除,不然重启容器后会使用自己pull下来的nginx而导致报错,如是其他镜像则不用删除,删除镜像命令:pulldocker rmi nginx 

上传
1. 先登陆私有库

push镜像

测试
docker rmi 172.16.186.139/opop/nginx:v1
docker images|grep nginx
docker pull 172.16.186.139/opop/nginx:v1
docker images|grep nginx

 

 

      欢迎加入QQ群一起讨论Linux、开源等技术

posted @ 2020-08-10 17:57  Linux大魔王  阅读(429)  评论(0编辑  收藏  举报