I'm trying to setup traefik 2.x to run on Docker for Windows. I have a docker-compose.yml file inside WSL. So far, I've managed to connect the Docker cli from WSL to talk to the Docker service running on the Windows host but I'm stuck with this error message when I try to bring the container up:
traefik | time="2020-04-25T07:05:13Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?" providerName=docker
Here's my docker-compose.yml file:
version: "3.3"
services:
traefik-proxy:
image: traefik:2.2
container_name: traefik
command:
- "--api=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.endpoint=tcp://localhost:2375"
- "--providers.file=true"
- "--configFile=/etc/traefik/traefik.yml"
restart: always
networks:
- proxy
ports:
- "80:80" #The HTTP port
- "443:443" #The HTTPS port
volumes:
- ./traefik/traefik.yml:/etc/traefik/traefik.yml
- ./traefik/dynamic:/etc/traefik/dynamic
- ./logs:/var/log/traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`localhost`)"
- "traefik.http.routers.traefik.service=api@internal"
networks:
proxy:
and my traefik.yml configuration file:
log:
level: WARN
api:
dashboard: true
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
file:
directory: /etc/traefik/dynamic
watch: true
docker:
endpoint: "tcp://localhost:2375"
exposedByDefault: false