docker-archive / dockercloud-haproxy

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

Can not link service or container in compose mode #249

Open exotfboy opened 5 years ago

exotfboy commented 5 years ago

docker-compose.yaml:

version: "3"
services:
  app:
      image: xxx
  proxy:
      image: dockercloud/haproxy
      links:
        - app
      ports:
        - 81:80
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock

After run docker-compose up --scale app=2 , I got logs like this:

proxy_1  |...07:13: INFO:haproxy:Haproxy is running by docker-compose, loading HAProxy definition through docker api
proxy_1  |...07:13: INFO:haproxy:dockercloud/haproxy PID: 8
proxy_1  |...07:13: INFO:haproxy:=> Add task: Initial start - Compose Mode
proxy_1  |...07:13: INFO:haproxy:=> Executing task: Initial start - Compose Mode
proxy_1  |...07:13: INFO:haproxy:==========BEGIN==========
proxy_1  |...07:13: INFO:haproxy:Linked service: 
proxy_1  |...07:13: INFO:haproxy:Linked container: 

Seems like that dockercloud-haproxy can not find and link any service.

And when I run wget http://localhost:81, I got the error like this:

Connecting to localhost (localhost)|127.0.0.1|:81... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

What's going on?

My docker version:18.09, and docker compose version: 1.23.1

db260179 commented 5 years ago

This is an easy fix, use the docker-compose 1.23.2, they have reverted that change so container names are now back to _1 instead of random generated.

db260179 commented 5 years ago

https://github.com/docker/compose/releases

exotfboy commented 5 years ago

Thanks, I will have a try.