How to run on Windows host (with Docker provider)


I can't figure out how to run traefik v2 on a Windows host (traefik.exe) using the Docker provider.

traefik.exe --configFile=traefik.toml

with this config
Release v2.1.4
on a Win Server 2019 LTSC 1809 host
gets me a non-working dashboard (the interface is greyed out and not functional)
I made one change in the sample config, in the [providers.docker] section:

endpoint = "npipe:////./pipe/docker_engine"

Does anyone have a working config for the Docker provider and with the necessary changes needed for Windows? Or if there's some official docs that I missed on this.

I managed to run and access the dashboard with this docker-compose.yml, but my services wouldn't come up:

version: '3'
    image: traefik:v2.1.4-windowsservercore-1809
    command: --api.insecure=true --providers.docker
      - "80:80"
      - "8080:8080"
      - .:C:/etc/traefik

I think I need to do something under "volumes", like:

      - type: npipe
        source: \\.\pipe\docker_engine
        target: \\.\pipe\docker_engine

But that gets me an error from docker-compose:

ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.reverse-proxy.volumes contains an invalid type, it should be a string

Stefan Scherers docker-compose files for Traefik v1 works, but I'm not looking to run v1.

Still hoping to find some help here. Can anyone explain how to run Traefik v.2.x on Windows? In Docker or otherwise.

Hope this working example will help:

version: '3'
image: traefik (USE YOUR VERSION!!!)
command: --api.insecure=true --providers.docker --providers.docker.endpoint=npipe:////./pipe/docker_engine
- "8080:8080" # Please read:
- "443:443"
- "80:80"
isolation: process # workaround for
- type: npipe
source: \.\pipe\docker_engine
target: \.\pipe\docker_engine

image: stefanscherer/whoami
- "traefik.http.routers.whoami1.rule=Host(whoami1.docker.localhost)"

image: stefanscherer/whoami
- "traefik.http.routers.whoami2.rule=Host(whoami2.docker.localhost)"

If that can help.

Here is my functional file. (not finish, still in progress)

version: '3.3'


# Use the latest v2.2.x Traefik image available
image: traefik:v2.8.1-windowsservercore-1809
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS
- 80:80
# Listen on port 443, default for HTTPS
- 443:443
- 8080:8080

  #  constraints:
  #    # Make the traefik service run only on the node with this label
  #    # as the node with it has the volume for the certificates
  #    - node.labels.traefik-public.traefik-public-certificates == true
    # Enable Traefik for this service, to make it available in the public network
    - traefik.enable=true
    # Use the traefik-public network (declared below)
    # Use the custom label "traefik.constraint-label=traefik-public"
    # This public Traefik will only use services with this label
    # That way you can add other internal Traefik instances per stack if needed
    #- traefik.constraint-label=traefik-public
    # admin-auth middleware with HTTP Basic auth
    # Using the environment variables USERNAME and HASHED_PASSWORD
   # - traefik.http.middlewares.admin-auth.basicauth.users=cboivin:$password
    # https-redirect middleware to redirect HTTP to HTTPS
    # It can be re-used by other stacks in other Docker Compose files
    - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
    - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
    # traefik-http set up only to use the middleware to redirect to https
    # Uses the environment variable DOMAIN
    -``) #Host(`$DOMAIN`)
    # traefik-https the actual router using HTTPS
    # Uses the environment variable DOMAIN
    - traefik.http.routers.traefik-public-https.rule=Host(``) #Host(`$DOMAIN`)
    - traefik.http.routers.traefik-public-https.entrypoints=https
    - traefik.http.routers.traefik-public-https.tls=true
    # Use the special Traefik service api@internal with the web UI/Dashboard
    - traefik.http.routers.traefik-public-https.service=api@internal
    # Use the "le" (Let's Encrypt) resolver created below
    - traefik.http.routers.traefik-public-https.tls.certresolver=le
    # Enable HTTP Basic auth, using the middleware created above
    - traefik.http.routers.traefik-public-https.middlewares=admin-auth
    # Define the port inside of the Docker service to use
  # Add Docker as a mounted volume, so that Traefik can read the labels of other services
  #-  local/docker.sock:/var/run/docker.sock
  # Mount the volume to store the certificates
  #- traefik-public-certificates:c:/certificates/
 # - ".:c:/letsencrypt/:rw"
  - type: npipe
    source: \\.\pipe\docker_engine
    target: \\.\pipe\docker_engine
  # Enable Docker in Traefik, so that it reads labels from Docker services
  - --providers.docker
  # Add a constraint to only use services with the label "traefik.constraint-label=traefik-public"
  #- --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`)
  # Do not expose all Docker services, only the ones explicitly exposed
  #- --providers.docker.exposedbydefault=false
  # Enable Docker Swarm mode
  - --providers.docker.swarmmode
  # Create an entrypoint "http" listening on port 80
  - --entrypoints.http.address=:80
  # Create an entrypoint "https" listening on port 443
  - --entrypoints.https.address=:443
  # Create the certificate resolver "le" for Let's Encrypt, uses the environment variable EMAIL
  # Store the Let's Encrypt certificates in the mounted volume
  # Use the TLS Challenge for Let's Encrypt
  #- --certificatesresolvers.le.acme.tlschallenge=true
  # Enable the access log, with HTTP requests
  - --accesslog
  # Enable the Traefik log, for configurations and errors
  - --log
  # Enable the Dashboard and API
  - --api.insecure=true  

  # Docker engine
  - --providers.docker.endpoint=npipe:////./pipe/docker_engine
  # Use the public network created to be shared between Traefik and
  # any other service that needs to be publicly available with HTTPS
  - traefik-public