美文网首页
harbor 镜像仓库搭建

harbor 镜像仓库搭建

作者: PC_Repair | 来源:发表于2020-01-20 19:59 被阅读0次

harbor 文档:

本人搭建的系统环境:

  • CentOS 7
  • docker 18.09.7
  • docker-compose 1.23.2

docker-compose 安装:

# docker-compose 安装
curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# docker-compose 卸载
sudo rm /usr/local/bin/docker-compose

注:docker-compose 的安装是在 安装了 docker 的基础上安装的。

docker 安装请参考:https://www.jianshu.com/p/72ec048aa7e9

harbor 安装:

{
  "insecure-registries":["101.xx.xx.xx"]
}
# 允许 http 访问的 registries
  • 重启 docker:service docker restart
  • 启动 harbor 服务:
    • 修改 harbor.yml 配置文件,将 hostname 修改为服务器公网 IP,如 101.xx.xx.xx,以供外网访问 harbor UI 界面。
屏幕快照 2020-01-20 下午7.37.49.png

启动服务后成功截图:

harbor_success1.png

harbor 默认账号密码:

  • account:admin
  • passowrd:Harbor12345

访问 UI 界面:

UI界面.png
  • push / pull 验证:

(1)login docker

[root@k8s-master nginx]# docker login 101.xx.xx.xx
Username: pusher 
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

注:可以去 harbor UI 界面创建特定权限的账户

(2)push

[root@k8s-master nginx]# docker tag jenkins:1.0.0 101.xx.xx.xx/kubernetes/jenkins:1.0.0
[root@k8s-master nginx]# docker push 101.xx.xx.xx/kubernetes/jenkins:1.0.0
The push refers to repository [hub.jiaflu.com/kubernetes/jenkins]
2ae589c85490: Pushed 
2376c9e05baa: Layer already exists 
f632d1d631d8: Layer already exists 
a8b89d74438f: Layer already exists 
d32e23a0d8e9: Pushed 
e7fe5541de5f: Layer already exists 
03ff63c55220: Layer already exists 
bee1e39d7c3a: Layer already exists 
1f59a4b2e206: Layer already exists 
0ca7f54856c0: Layer already exists 
ebb9ae013834: Layer already exists 
1.0.0: digest: sha256:35b432de7c5a59b0368881ecfcb530398395445c6d056f81c63be9fc027d9e18 size: 2634

注:需要自己准备好镜像,并打好标签

(3)pull

[root@k8s-node1 ~]# docker pull 101.xx.xx.xx/kubernetes/jenkins:1.0.0
1.0.0: Pulling from kubernetes/jenkins
Digest: sha256:35b432de7c5a59b0368881ecfcb530398395445c6d056f81c63be9fc027d9e18
Status: Downloaded newer image for 101.133.144.182/kubernetes/jenkins:1.0.0

相关文章

网友评论

      本文标题:harbor 镜像仓库搭建

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