问题:Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client
无法上传
[root@localhost data]# docker push 192.168.238.10:5000/nginx
Using default tag: latest
The push refers to repository [192.168.238.10:5000/nginx]
Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client
[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest
The push refers to repository [192.168.238.10:5000/nginx]
Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client
[root@localhost data]# curl -XGET http://192.168.238.10:5000/v2/_catalog
{"repositories":[]}
原因:/etc/docker/daemon.json文件配置有问题
[root@localhost data]# vim /etc/docker/daemon.json
{
"insecure-registries":["192.168.238.10:5000"], #是registries不是registry
"registry-mirrors": ["https://4xxxxxxx.mirror.aliyuncs.com"]
}
[root@localhost data]# systemctl restart docker.service
问题:Get http://192.168.238.10:5000/v2/: dial tcp 192.168.238.10:5000: connect: connection refused
[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest
The push refers to repository [192.168.238.10:5000/nginx]
Get http://192.168.238.10:5000/v2/: dial tcp 192.168.238.10:5000: connect: connection refused
原因:docker里registry端口映射服务关闭了
[root@localhost data]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos os-7 400cf047cbc5 About an hour ago 286MB
192.168.238.10:5000/nginx latest f6d0b4767a6c 2 months ago 133MB
nginx latest f6d0b4767a6c 2 months ago 133MB
registry latest 678dfa38fcfa 3 months ago 26.2MB
[root@localhost data]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
375179e20662 registry "/entrypoint.sh /etc…" 40 minutes ago Exited (2) About a minute ago hardcore_germain #端口映射关闭了
70673b43a615 registry "/entrypoint.sh /bin…" 45 minutes ago Exited (127) 44 minutes ago eloquent_hoover
4e0245a200ff nginx:latest "/docker-entrypoint.…" 2 hours ago Exited (137) 50 minutes ago confident_cohen
解决:开启映射
[root@localhost data]# docker start 375179e20662 #开启映射
375179e20662
[root@localhost data]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
375179e20662 registry "/entrypoint.sh /etc…" 41 minutes ago Up 1 second 0.0.0.0:5000->5000/tcp hardcore_germain ###############开启了
70673b43a615 registry "/entrypoint.sh /bin…" 46 minutes ago Exited (127) 45 minutes ago eloquent_hoover
4e0245a200ff nginx:latest "/docker-entrypoint.…" 2 hours ago Exited (137) 51 minutes ago confident_cohen
上传成功了
[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest
The push refers to repository [192.168.238.10:5000/nginx]
85fcec7ef3ef: Pushed
3e5288f7a70f: Pushed
56bc37de0858: Pushed
1c91bf69a08b: Pushed
cb42413394c4: Pushed
latest: digest: sha256:0b159cd1ee1203dad901967ac55eee18c24da84ba3be384690304be93538bea8 size: 1362