dockercloud-haproxy
dockercloud-haproxy copied to clipboard
Can not link service or container in compose mode
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
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.
https://github.com/docker/compose/releases
Thanks, I will have a try.