Http: server gave HTTP response to HTTPS client

Description
I am trying to setup docker machine across multiple hosts, in an insecure way. I have followed the official configuration guide for local registry and created a daemon.json placed in /etc/docker/daemon.json. When I try to connect to the remote docker daemon, I’m getting this error :

Unable to query docker version: Get https://10.xxx.xxx.xxx:2376/v1.15/version: http: server gave HTTP response to HTTPS client

I tried the same get request in the browser using http instead of https and got this response

{“Version”:“17.09.0-ce”,“ApiVersion”:“1.32”,“MinAPIVersion”:“1.12”,“GitCommit”:“afdb6d4”,“GoVersion”:“go1.8.3”,“Os”:“linux”,“Arch”:“amd64”,“KernelVersion”:“3.10.0-514.16.1.el7.x86_64”,“BuildTime”:“2017-09-26T22:42:49.000000000+00:00”}
my /etc/docker/daemon.json is

{
“insecure-registries”: [“10.xxx.xxx.xxx:2376”]
}

Command

I’m registering the existing remote docker daemon on my host using this command

docker-machine create --driver none --url=tcp://10.xxx.xxx.xxx:2376 myRemoteDaemon

Error:

docker-machine env myRemoteDaemon

When I run this command on my host machine, it was throwing this error

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host “10.xxx.xxx.xxx:2376”: tls: oversized record received with length 20527

And the command “docker-machine ls” is giving

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS

myRemoteDaemon - none Running tcp://10.xxx.xxx.xxx:2376 Unknown Unable to query docker version: Get https://10.xxx.xxx.xxx:2376/v1.15/version: http: server gave HTTP response to HTTPS client

docker info :

Containers: 9
Running: 0
Paused: 0
Stopped: 9
Images: 49
Server Version: 17.09.0-ce
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: 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
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.16.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51GiB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
10.xxx.xxx.xxx:2376
127.0.0.0/8
Live Restore Enabled: false

Did you solve it? I facing the same problem.

I gave up on docker machine and moved to docker swarm cloud mode :slight_smile:

did you solve it?this question confused me

Hi, do you now happened to resolve this issue,
/etc/docker/daemon.json:
{ "insecure-registries":["dockerreg.mydomain.net:5000"] }
because i am facing same thing. FaceTime
Try this hope it helps.
Thanks.

In my case it was resolved by having “insecure-registries” entry in /etc/docker/daemon.json both in Host and Client.
I didnt add it in client and was getting the error.