Docker repository server gave HTTP response to HTTPS client

守給你的承諾、 提交于 2020-07-18 03:36:07

问题


I use Docker toolbox for windows and i`m trying run private docker registry from this documentation https://docs.docker.com/registry/deploying/

But it`s not work for me. Error after this:

$ docker pull 192.168.99.100:5000/my-ubuntu

Error

$ docker pull 192.168.99.100:5000/image
Using default tag: latest
Error response from daemon: Get https://192.168.99.100:5000/v2/: http: server gave HTTP response to HTTPS client

I`m thinking that error is something in my docker client.

For information this is my docker info

Containers: 6
 Running: 4
 Paused: 0
 Stopped: 2
Images: 19
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 144
 Dirperm1 Supported: true
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: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.74-boot2docker
Operating System: Boot2Docker 17.06.0-ce (TCL 7.2); HEAD : 0672754 - Thu Jun 29 00:06:31 UTC 2017
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.8MiB
Name: default
ID: ZMCX:NXC7:3BSV:ZNWV:MDZO:FW26:6MX5:UWI6:NVRL:XP56:AKGC:Z3TW
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 47
 Goroutines: 56
 System Time: 2018-04-05T13:43:42.856720067Z
 EventsListeners: 0
Username: kacalek
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

If i try on mac so everythink is perfect.

Do you know how this error to solve?

Thank you so much for every answers!


回答1:


Looks like you haven't set the Docker Daemon right. Notice these few lines:

Insecure Registries:
 127.0.0.0/8

Try to add this line to Docker's daemon.json file and restart the Docker Daemon:

"insecure-registries":["192.168.99.100:5000"]



回答2:


On CentOS 7.2.1511, I had to create a new file

/etc/docker/daemon.json 

with the contents

{ "insecure-registries":["host:port"] } 

(The host is the hostname of the server hosting my docker registry and port is the port where the docker registry is available. In my case, those are 192.168.99.1:50000)

and then restart docker daemon by doing:

$ sudo service docker restart



回答3:


Hopefully this will help anyone having issues getting the ```insecure-registries`` fix to work.

Adding

{ "insecure-registries":["host:port"] }

to

/etc/docker/daemon.json

did not work for me until I created the file

/etc/default/docker

and put the line

DOCKER_OPTS="--config-file=/etc/docker/daemon.json"

in it and then restarted the docker daemon with

sudo systemctl stop docker and sudo systemctl start docker.

For some reason just doing a sudo systemctl restart docker did not work. It threw an error about trying to restart the service to quickly.

Also for ["host:port"] I used the IP of my Docker registry as opposed to the hostname as I did not have DNS or a hosts file setup to be able to find the registry by hostname.

This drove me absolutely nuts until I stumbled upon the /etc/default/docker bit here.

I am new to Docker and so I don't know if this is new requirement since this initial post was answered or if there was something else I missed when I first setup my registry. Though all I did was to follow the current docs on the Docker site itself.




回答4:


If you are using Docker Desktop for Windows:

  • Click the docker whale icon in the task bar

  • A menu appears, click Settings

  • A popup appears, click Daemon

  • Entry your insecure registry in the "Insecure registries" text area

  • Click apply

Job done, no need to manually edit any files



来源:https://stackoverflow.com/questions/49674004/docker-repository-server-gave-http-response-to-https-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!