My goal
- access container named 'nginx' using http://nginx.test
- access container named 'apache' using http://apache.test
My docker-compose.yml
version: "3.9"
services:
nginx:
image: nginx
container_name: nginx
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx.rule=Host(`nginx.test`)"
- "traefik.http.services.nginx.loadbalancer.server.port=80"
ports:
- "9000:80"
expose:
- 80
apache:
image: httpd
container_name: apache
labels:
- "traefik.enable=true"
- "traefik.http.routers.apache.rule=Host(`apache.test`)"
- "traefik.http.services.apache.loadbalancer.server.port=80"
expose:
- 80
ports:
- "9001:80"
proxy:
image: "traefik:v2.5"
container_name: "proxy"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
depends_on:
- nginx
- apache
ports:
- "80:80"
- "8080:8080"
volumes:
- ./proxy.sock:/var/run/proxy.sock:ro
Actually I can see that both apache and nginx are running , because I can access using
But I cannot access without using port numbers
Inspecting traefik container I noticed
2024-03-07 10:56:16 time="2024-03-07T09:56:16Z" level=debug msg="FIXME: Got an status-code for which error does not match any expected type!!!: -1" status_code=-1 module=api
2024-03-07 10:56:16 time="2024-03-07T09:56:16Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" providerName=docker
2024-03-07 10:56:16 time="2024-03-07T09:56:16Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 27.440293063s" providerName=docker