docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

unable to connect to docker daemon 400 #170

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hey Guys,

Im having some issus running a simple docker-compose app from the wiki.

docker-compse.yml

version: '2'
services:
  web:
    image: dockercloud/hello-world
  lb:
    image: dockercloud/haproxy
    links:
      - web
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 80:80

Curl Output

curl http://localhost/
curl: (56) Recv failure: Connection reset by peer

I get the following errors either running with sudo as root and disabled selinux

Creating haproxydockercloud_web_1
Creating haproxydockercloud_lb_1
Attaching to haproxydockercloud_web_1, haproxydockercloud_lb_1
lb_1   | INFO:haproxy:dockercloud/haproxy 1.6.3 is running outside Docker Cloud
lb_1   | INFO:haproxy:Haproxy is running using legacy link, loading HAProxy definition from environment variables: unable to connect to docker daemon 400 Client Error: Bad Request ("client is newer than server (client API version: 1.24, server API version: 1.22)")
lb_1   | INFO:haproxy:dockercloud/haproxy PID: 7
lb_1   | INFO:haproxy:=> Add task: Initial start - Legacy Mode
lb_1   | INFO:haproxy:=> Executing task: Initial start - Legacy Mode
lb_1   | INFO:haproxy:==========BEGIN==========
lb_1   | INFO:haproxy:HAProxy configuration:
lb_1   | global
lb_1   |   log 127.0.0.1 local0
lb_1   |   log 127.0.0.1 local1 notice
lb_1   |   log-send-hostname
lb_1   |   maxconn 4096
lb_1   |   pidfile /var/run/haproxy.pid
lb_1   |   user haproxy
lb_1   |   group haproxy
lb_1   |   daemon
lb_1   |   stats socket /var/run/haproxy.stats level admin
lb_1   |   ssl-default-bind-options no-sslv3
lb_1   |   ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA
lb_1   | defaults
lb_1   |   balance roundrobin
lb_1   |   log global
lb_1   |   mode http
lb_1   |   option redispatch
lb_1   |   option httplog
lb_1   |   option dontlognull
lb_1   |   option forwardfor
lb_1   |   timeout connect 5000
lb_1   |   timeout client 50000
lb_1   |   timeout server 50000
lb_1   | listen stats
lb_1   |   bind :1936
lb_1   |   mode http
lb_1   |   stats enable
lb_1   |   timeout connect 10s
lb_1   |   timeout client 1m
lb_1   |   timeout server 1m
lb_1   |   stats hide-version
lb_1   |   stats realm Haproxy\ Statistics
lb_1   |   stats uri /
lb_1   |   stats auth stats:stats
lb_1   | INFO:haproxy:Launching HAProxy
lb_1   | INFO:haproxy:HAProxy has been launched(PID: 13)
lb_1   | INFO:haproxy:===========END===========
tifayuki commented 7 years ago

I think the problem has something to do with the version of your docker engine. It is too old for docker-py to connect to. You can either try it on a newer version of docker, or use docker compose v1 instead of v2.

ghost commented 7 years ago

I dont think so i have the newest version of docker running on fedora

docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-55.gite03ddb8.fc24.x86_64
 Go version:      go1.6.3
 Git commit:      e03ddb8/1.10.3
 Built:           
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-55.gite03ddb8.fc24.x86_64
 Go version:      go1.6.3
 Git commit:      e03ddb8/1.10.3
 Built:           
 OS/Arch:         linux/amd64
tifayuki commented 7 years ago

@Numblesix

Currently, the latest version of docker 1.13. The docker coming with Fedora is far outdated. You can follow docs here to upgrade it: https://docs.docker.com/engine/installation/linux/fedora/

ghost commented 7 years ago

Issue was the version updated to the newest one and it works like a charm :)