harbor 镜像仓库搭建

2020-01-20  本文已影响0人  PC_Repair

harbor 文档:

本人搭建的系统环境:

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
屏幕快照 2020-01-20 下午7.37.49.png

启动服务后成功截图:

harbor_success1.png

harbor 默认账号密码:

  • account:admin
  • passowrd:Harbor12345

访问 UI 界面:

UI界面.png

(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
上一篇 下一篇

猜你喜欢

热点阅读