打赏
Fork me on GitHub

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

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

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

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

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

解决方法:

  在/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.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:11:02 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:09:05 2018
  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: 2 Running: 0 Paused: 0 Stopped: 2 Images: 20 Server Version: 18.06.0-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.0-21-generic Operating System: Ubuntu 16.04 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 1.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/8 Registry Mirrors: http://5a9b2e97.m.daocloud.io/ Live Restore Enabled: false

 

posted @ 2018-08-06 16:31  my_cool2007  阅读(878)  评论(0编辑  收藏  举报