简体   繁体   中英

docker client (docker 1.12/centos) http: server gave HTTP response to HTTPS client

Set up docker 1.12 on centos 7. docker was started using systemd with the following commandline (according to systemctl status docker):

/usr/bin/dockerd -D --tls=false --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://10.10.2.1:2376

then I want to check on the local machine, setting the following environment variables:

DOCKER_HOST=tcp://10.10.2.1:2376
DOCKER_TLS_VERIFY=0
DOCKER_MACHINE_NAME=default

Then checking with the docker commandline tool:

docker --tls=false --tlsverify=false  images

results in:

An error occurred trying to connect: Get https://10.10.2.1:2376/v1.24/images/json : http: server gave HTTP response to HTTPS client

Whereas a quick check:

curl http://10.10.2.1:2376/images/json

gives the images info.

Now: I assume the server does respond to http, (which was intended), but how to get the client to talk http as well ?

It needs to explicitly define that your registry is not secure:

  • open /etc/docker/daemon.json file
  • add your registry to insecure-list
{
  ..
  "insecure-registries" : [
    "10.10.2.1:2376"
  ],
  ..
}
  • restart Docker-service
sudo service docker restart

see for details Docker: Test an insecure registry

Port 2376 is for TLS communication. Use port 2375 instead.

DOCKER_HOST=tcp://10.10.2.1:2375

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM