I have a dedicated server configured with:
Ubuntu 18.04
Docker version 19.03.13
docker-compose version 1.27.3
I am attempting to access the Traefik dashboard from a remote PC but am not having any luck so far. I have posted my configuration files below (with limited edits to remove the domain name):
#.env File
TZ=Europe/Amsterdam
DOMAIN=example.net # not actual domain
USERDIR=/home/user
#traefik.yml
version: '3.7'
services:
traefik:
image: traefik:v2.3
container_name: traefik
ports:
- 80:80
- 443:443
volumes:
- ${USERDIR}/docker/traefik/traefik.toml:/etc/traefik/traefik.toml
# touch acme.json && chmod 600 acme.json
- ${USERDIR}/docker/letsencrypt/acme.json:/acme.json:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- app-net
labels:
- traefik.enable=true
- traefik.http.routers.api.rule=Host(`traefik.${DOMAIN}`)
- traefik.http.routers.api.service=api@internal
- traefik.http.routers.api.entrypoints=websecure
# ACME
- traefik.http.routers.api.tls.certresolver=myresolver
## HTTP REDIRECT
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
- traefik.http.routers.redirect-https.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.redirect-https.entrypoints=web
- traefik.http.routers.redirect-https.middlewares=redirect-to-https
networks:
app-net:
external: true
#traefik.toml
[log]
# DEBUG, PANIC, FATAL, ERROR, WARN, and INFO
level = "DEBUG" # Should change this after setup
[api]
dashboard = true
debug = true
insecure = true # If true, you can access dashboard on 8080 port (open 8080 first..)
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false # traefik.enable=true is needed
network = "app-net"
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[certificatesResolvers.myresolver.acme]
email = "email@email.com"
storage = "acme.json"
# For testing, use staging server - uses production by default
#caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
[certificatesResolvers.myresolver.acme.httpChallenge]
# Port 80 needs to be open
entryPoint = "web"
[ping]
entryPoint = "web"
[http]
[http.routers]
# Define a connection between requests and services
[http.routers.to-dashboard]
rule = "Host(`traefik.${DOMAIN}`)"
service = "traefik"
And finally, this is the error I get when I run docker-compose -f traefik.yml run traefik
:
ERRO[2020-09-26T20:05:06Z] Unable to obtain ACME certificate for domains "traefik.<edit>.<edit>": unable to generate a certificate for the domains [traefik.<edit>.<edit>]: error: one or more domains had a problem:
[traefik.<edit>.<edit>] acme: error: 400 :: urn:ietf:params:acme:error:connection :: Fetching http://traefik.<edit>.<edit>/.well-known/acme-challenge/eDCPXACyrzWSO29WStXAY8pIvSeEar1nthz7dPbT59I: Connection refused, url: providerName=myresolver.acme routerName=api@docker rule="Host(`traefik.<edit>.<edit>`)"
I can also confirm that I am not being interrupted by a firewall.