dockercloud-haproxy icon indicating copy to clipboard operation
dockercloud-haproxy copied to clipboard

Can not link service or container in compose mode

Open exotfboy opened this issue 6 years ago • 3 comments
trafficstars

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

exotfboy avatar Nov 23 '18 08:11 exotfboy

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 avatar Dec 11 '18 10:12 db260179

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

db260179 avatar Dec 11 '18 10:12 db260179

Thanks, I will have a try.

exotfboy avatar Dec 12 '18 06:12 exotfboy