Hello, I am trying to setup a traefik container on Windows. I am using a config that I have made and it works on a linux machine, however when I try to start the config on Windows I get this weird error - "Cannot connect to the docker daemon at unix://var/run/docker.sock. Is the docker daemon running?" Here is my config -
version: "3.7"
########################### NETWORKS
# You may customize the network subnet (192.168.90.0/24) below as you please.
# Docker Compose version 3.5 or higher required to define networks this way.
networks:
t2_proxy:
external:
name: t2_proxy
default:
driver: bridge
services:
############################# FRONTENDS
# Traefik 2 - Reverse Proxy
traefik:
container_name: traefik
image: traefik:2.7
restart: unless-stopped
command: # CLI arguments
- --global.checkNewVersion=true
- --global.sendAnonymousUsage=true
- --entryPoints.http.address=:80
- --entryPoints.https.address=:443
# Allow these IPs to set the X-Forwarded-* headers - Cloudflare IPs: https://www.cloudflare.com/ips/
- --entrypoints.https.forwardedHeaders.trustedIPs=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22
- --api=true
- --serversTransport.insecureSkipVerify=true
# - --log=true
# - --log.filePath=/logs/traefik.log
# - --log.level=INFO # (Default: error) DEBUG, INFO, WARN, ERROR, FATAL, PANIC
# - --accessLog=true
# - --accessLog.filePath=/logs/access.log
# - --accessLog.bufferingSize=100 # Configuring a buffer of 100 lines
# - --accessLog.filters.statusCodes=204-299,400-499,500-599
# - --providers.docker=true
# - --providers.docker.endpoint=C:\Program Files\Docker\Docker\resources\com.docker.build.exe # Use Docker Socket Proxy instead for improved security
# - --providers.docker.endpoint=tcp://socket-proxy:2375 # Use this instead of the previous line if you have socket proxy.
- --providers.docker.exposedByDefault=false
- --entrypoints.https.http.tls.options=tls-opts@file
- --entrypoints.https.http.tls=true
# Add dns-cloudflare as default certresolver for all services. Also enables TLS and no need to specify on individual services
- --entrypoints.https.http.tls.certresolver=dns-cloudflare
- --entrypoints.https.http.tls.domains[0].main=website
- --entrypoints.https.http.tls.domains[0].sans=*.website
# - --entrypoints.https.http.tls.domains[1].main=$DOMAINNAME2 # Pulls main cert for second domain
# - --entrypoints.https.http.tls.domains[1].sans=*.$DOMAINNAME2 # Pulls wildcard cert for second domain
- --providers.docker.network=t2_proxy
- --providers.docker.swarmMode=false
- --providers.file.directory=/rules # Load dynamic configuration from one or more .toml or .yml files in a directory
# - --providers.file.filename=/path/to/file # Load dynamic configuration from a file
- --providers.file.watch=true # Only works on top level files in the rules folder
# - --certificatesResolvers.dns-cloudflare.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory # LetsEncrypt Staging Server - uncomment when testing
- --certificatesResolvers.dns-cloudflare.acme.email=landerslin@live.com
- --certificatesResolvers.dns-cloudflare.acme.storage=/acme.json
- --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.provider=cloudflare
- --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.resolvers=1.1.1.1:53,1.0.0.1:53
- --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.delayBeforeCheck=90 # To delay DNS check and reduce LE hitrate
# networks:
# t2_proxy:
# ipv4_address: 10.16.0.26 # You can specify a static IP
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
volumes:
- C:\Users\lande\Desktop\traefik\rules\cloudserver:/rules # file provider directory
# - \var\run\docker.sock:/var/run/docker.sock:ro # If you use Docker Socket Proxy, comment this line out
- C:\Users\lande\Desktop\traefik\acme\acme.json:/acme.json # cert location - you must create this empty file and change permissions to 600
# - C:\Users\lande\Desktop\traefik\logs\cloudserver\traefik:/logs # for fail2ban or crowdsec
# - $DOCKERDIR/shared:/shared
labels:
- "traefik.enable=true"
# HTTP Routers
- "traefik.http.routers.traefik-rtr.entrypoints=https"
- "traefik.http.routers.traefik-rtr.tls=true" # Some people had 404s without this
- "traefik.http.routers.traefik-rtr.tls.certresolver=dns-cloudflare" # Comment out this line after first run of traefik to force the use of wildcard certs
- "traefik.http.routers.traefik-rtr.tls.domains[0].main=website"
- "traefik.http.routers.traefik-rtr.tls.domains[0].sans=*.website"
## Services - API
- "traefik.http.routers.nginx-laptop-svc=api@internal"
## Middlewares
- "traefik.http.routers.traefik-rtr.middlewares=chain-no-auth@file"
If you need all of the files tell me. I don't know if I am doing the files right either.