[原]Docker-issue(2) http: server gave HTTP response to HTTPS client

时间:2023-03-10 07:23:55
[原]Docker-issue(2)  http: server gave HTTP response to HTTPS client

系统环境 查看 文章末尾 附录

问题点:新建local registry后,push新的image到local registry  未能成功,并报错误:

The push refers to repository [ip:/horizon2007/httpd] Get https://IP:5000/v2/: http: server gave HTTP response to HTTPS client 

查阅文档:https://docs.docker.com/registry/insecure/

[原]Docker-issue(2)  http: server gave HTTP response to HTTPS client

解决方法:

  在/etc/hosts中添加: (192.168.184.130为本机IP)

root@localhost:/etc/docker# echo "192.168.184.130 hub.docker.horizon.io" >> /etc/hosts

  在/etc/docker/daemon.json中添加一条:

{
"registry-mirrors": ["http://5a9b2e97.m.daocloud.io"],
"insecure-registries": ["hub.docker.horizon.io:5000"]
}

重启

service docker restart

再次推送到本地registry:

root@localhost:/etc/docker# docker push hub.docker.horizon.io:5000/httpd:v2.2
The push refers to repository [hub.docker.horizon.io:5000/httpd]
ab5efd5aec77: Pushed
9058feb62b4a: Pushed
3f7f50ced288: Pushed
71436bd6f1c4: Pushed
4bcdffd70da2: Pushed
v2.2: digest: sha256:558680adf8285edcfe4813282986eb7143e3c372610c6ba488723786bd5b34c5 size: 1366

--------------------------------------------

附录:系统环境 

Client:
Version: 18.06.-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul ::
OS/Arch: linux/amd64
Experimental: false Server:
Engine:
Version: 18.06.-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul ::
OS/Arch: linux/amd64
Experimental: false

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

root@localhost:/etc/docker# docker info
Containers:
Running:
Paused:
Stopped:
Images:
Server Version: 18.06.-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.--generic
Operating System: Ubuntu 16.04 LTS
OSType: linux
Architecture: x86_64
CPUs:
Total Memory: .95GiB
Name: horizon-virtual-machine
ID: FRRK:DIDH:XQDM:VHNJ:XVLQ:ZPPM:CWQZ:KSR3:5KN4:LEYM:2HWG:R2KL
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: horizon2007
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/
Registry Mirrors:
http://5a9b2e97.m.daocloud.io/
Live Restore Enabled: false