Harbor仓库用法

首先可以进入harbor仓库

增加一台主机 注意:需要安装docker

在另一台主机上面增加服务端一个映射关系

[root@client ~]# vim /etc/hosts
[root@client ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.119.155 localhost.localdomain


[root@client ~]# 
[root@client ~]# ping localhost.localdomain
PING localhost.localdomain(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.167 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.167 ms
64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.121 ms
64 bytes from localhost (::1): icmp_seq=4 ttl=64 time=0.050 ms
^C
--- localhost.localdomain ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3091ms
rtt min/avg/max/mdev = 0.050/0.126/0.167/0.048 ms
[root@client ~]# 

在客户端上登录自己搭建的私有仓库

由于手动搭建的仓库没有证书,所以需要手动设置

[root@client ~]# vim /etc/docker/daemon.json 
[root@client ~]# 
[root@client ~]# 
[root@client ~]# cat /etc/docker/daemon.json 
{
	  "registry-mirrors": ["https://ivknqowi.mirror.aliyuncs.com"],
	  "insecure-registries": ["192.168.119.155"],
	  
}

[root@client ~]# 
[root@client ~]# 
[root@client ~]# 
[root@client ~]# systemctl restart docker
[root@client ~]# 

登录自己的Harbor仓库
[root@client ~]# docker login 192.168.119.155
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
[root@client ~]# 
[root@client ~]# 

上传镜像之前要修改镜像名称,在进行上传

[root@client ~]# docker pull httpd
Using default tag: latest
latest: Pulling from library/httpd
a2abf6c4d29d: Pull complete 
dcc4698797c8: Pull complete 
41c22baa66ec: Pull complete 
67283bbdd4a0: Pull complete 
d982c879c57e: Pull complete 
Digest: sha256:0954cc1af252d824860b2c5dc0a10720af2b7a3d3435581ca788dff8480c7b32
Status: Downloaded newer image for httpd:latest
docker.io/library/httpd:latest
[root@client ~]# 
[root@client ~]# docker images
REPOSITORY                            TAG       IMAGE ID       CREATED        SIZE
httpd                                 latest    dabbfbe0c57b   7 months ago   144MB
[root@client ~]# docker tag httpd:latest 192.168.119.155/library/httpd:v0.1
[root@client ~]# 
[root@client ~]# docker images
REPOSITORY                            TAG       IMAGE ID       CREATED        SIZE
httpd                                 latest    dabbfbe0c57b   7 months ago   144MB
192.168.119.155/library/httpd         v0.1      dabbfbe0c57b   7 months ago   144MB

[root@client ~]# docker push 192.168.119.155/library/httpd:v0.1 
The push refers to repository [192.168.119.155/library/httpd]
deefaa620a71: Pushed 
9cff3206f9a6: Pushed 
15e4bf5d0804: Pushed 
1da636a1aa95: Pushed 
2edcec3590a4: Pushed 
v0.1: digest: sha256:57c1e4ff150e2782a25c8cebb80b574f81f06b74944caf972f27e21b76074194 size: 1365
[root@client ~]# 
[root@client ~]# 

其他的应用

创建系统账户

建立新的仓库

复制管理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值