登录

1
2
3
[root@node1 harbor]# docker login -u admin -p Harbor12345  http://10.80.80.251
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://10.80.80.251/v2/: read tcp 10.80.80.251:50374->10.80.80.251:443: read: connection reset by peer
原因如下:

docker 默认使用https(生产建议走生产带证书域名),如果仓库使用了http,则要修改下Docker的配置:/etc/docker/daemon.json, 添加参数insecure-registries:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@node1 harbor]#  cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://v5d7kh0f.mirror.aliyuncs.com"],
"insecure-registries": ["10.80.80.251"]
}

# 重启docker
[root@node1 harbor]# systemctl restart docker



# 重启后登录
[root@node1 harbor]# docker login -u admin -p Harbor12345 http://10.80.80.251
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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

查看镜像列表

1
2
3
4
5
6
7
[root@node1 harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

gcr.io/google_containers/cluster-proportional-autoscaler-amd64 1.3.0 33813c948942 3 months ago 45.8MB
registry.cn-hangzhou.aliyuncs.com/ringtail/cluster-proportional-autoscaler-amd64 v1.3.0 33813c948942 3 months ago 45.8MB
cr.io/google_containers/cluster-proportional-autoscaler-amd64 1.3.0 33813c948942 3 months ago 45.8MB
google_containers/cluster-proportional-autoscaler-amd64 1.3.0 33813c948942 3 months ago 45.8MB

例如需要把 registry.cn-hangzhou.aliyuncs.com/google_containers/cluster-proportional-autoscaler-amd64 上传到horbar仓库,则步操如下:

1、打tag

1
docker tag registry.cn-hangzhou.aliyuncs.com/ringtail/cluster-proportional-autoscaler-amd64:v1.3.0 10.80.80.251/google_containers/cluster-proportional-autoscaler-amd64:1.3.0

2、登录

看开头上文

3、PUSH(需要提前在Horbar新增项目google_containers)

1
2
3
4
[root@node1 harbor]# docker push   10.80.80.251/google_containers/cluster-proportional-autoscaler-amd64:1.3.0
The push refers to repository [10.80.80.251/google_containers/cluster-proportional-autoscaler-amd64]
a636ea940e54: Pushed
1.3.0: digest: sha256:4fd37c5b29a38b02c408c56254bd1a3a76f3e236610bc7a8382500bbf9ecfc76 size: 528

Comments

2019-02-18