Harbor仓库部署安装

Harbor仓库部署安装

操作系统:CentOS 7
IP:192.168.70.146
Harbor版本:1.6.0

安装环境准备

Harbor 的所有服务组件都是在 Docker 中部署的,官方安装使用 docker-compose 快速部署,所以我们需要安装 Docker、docker-compose。由于 Harbor 是基于Docker Registry V2版本,所以就要求 Docker 版本不小于1.10.0,docker-compose 版本不小于1.6.0

安装

下载离线安装包并修改配置

# wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-offline-installer-v1.6.0.tgz
# tar xvzf harbor-offline-installer-v1.6.0.tgz
# cd harbor
# vim harbor.cfg
hostname = 192.168.70.146   #改成自己的ip或域名
ui_url_protocol = http

使用脚本进行部署

# ./install.sh
[Step 0]: checking installation environment ...

Note: docker version: 19.03.5

Note: docker-compose version: 1.25.0

[Step 1]: loading Harbor images ...
Loaded image: goharbor/harbor-log:v1.6.0
Loaded image: goharbor/harbor-db:v1.6.0
Loaded image: goharbor/nginx-photon:v1.6.0
Loaded image: goharbor/notary-server-photon:v0.5.1-v1.6.0
Loaded image: goharbor/chartmuseum-photon:v0.7.1-v1.6.0
Loaded image: goharbor/harbor-ui:v1.6.0
Loaded image: goharbor/harbor-jobservice:v1.6.0
Loaded image: goharbor/redis-photon:v1.6.0
Loaded image: goharbor/registry-photon:v2.6.2-v1.6.0
Loaded image: goharbor/notary-signer-photon:v0.5.1-v1.6.0
Loaded image: goharbor/clair-photon:v2.0.5-v1.6.0
Loaded image: goharbor/harbor-migrator:v1.6.0
Loaded image: goharbor/harbor-adminserver:v1.6.0

[Step 2]: preparing environment ...
The configuration files are ready, please use docker-compose to start the service.

[Step 3]: checking existing instance of Harbor ...

[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registry           ... done
Creating harbor-adminserver ... done
Creating redis              ... done
Creating harbor-db          ... done
Creating harbor-ui          ... done
Creating nginx              ... done
Creating harbor-jobservice  ... done

✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://192.168.70.146.
For more details, please visit https://github.com/goharbor/harbor .

运行成功后会看到如下启动的容器
Harbor仓库部署安装_第1张图片

登录harbor

地址:http://192.168.70.146
用户名:admin
密码:Harbor12345
Harbor仓库部署安装_第2张图片

测试推送

因为 Docker Registry 默认使用的是 https 协议,当前 Harbor 使用的是 http 协议,先配置客户端忽略 https 访问:

# vim /etc/docker/daemon.json 
{
        "registry-mirrors": ["http://hub-mirror.c.163.com"],
        "insecure-registries": ["192.168.70.146"]
}

重启 Docker 使配置生效

# systemctl daemon-reload && systemctl restart docker

下载测试镜像并登录仓库

# docker pull hello-world
# docker login 192.168.70.146
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.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

给镜像打标签

# docker tag hello-world 192.168.70.146/abc/hello-world:latest

push到仓库

# docker push 192.168.70.146/abc/hello-world

你可能感兴趣的:(Linux点滴,Docker点滴)