Hello,
New to the forum here, hoping to find some support. From what I've read it seems like a pretty nice community here
I am currently trying to set up a basic Docker server that allows me for testing various docker containers very easily.
In the graphics bellow i tried to illustrate the current scenario for better understanding.
Note: The myPhpAdmin Container is planned and not yet added in the docker-compose file bellow.
We have on Ubuntu 20.04 Server running Docker. This server has two Network interfaces assigned to it. For each NIC there are different DNS entries. For every DNS entry i have created SSL-Certs (company own pki)
For a reason, i don't want to go into, we need to use paths instead of "subdomains".
The goal is to have traefik listen to both interfaces and let it do it's magic as a reverse proxy.
As of now, when running my docker compose i am not able to access anything, not even the dashboard. Alltough i get a /dashboard forwarding when i try to access it using the 8080 port (http & https, no dashboard loading)
con-hst.domain.local:8080 ->-> con-hst.domain.local:8080/dashboard
I get this log when running my docker compose:
traefik | time="2020-11-03T14:56:34+01:00" level=info msg="Configuration loaded from file: /traefik.yml"
traefik | time="2020-11-03T14:56:34+01:00" level=error msg="Cannot start the provider *file.Provider: field not found, node: middleware"
traefik | time="2020-11-03T14:56:35+01:00" level=error msg="middleware \"https-redirect@docker\" does not exist" entryPointName=http routerName=traefik@docker
traefik | time="2020-11-03T14:56:37+01:00" level=error msg="middleware \"https-redirect@docker\" does not exist" entryPointName=http routerName=portainer@docker
traefik | time="2020-11-03T14:56:37+01:00" level=error msg="middleware \"https-redirect@docker\" does not exist" entryPointName=http routerName=traefik@docker
traefik | time="2020-11-03T14:56:37+01:00" level=error msg="middleware \"https-redirect@docker\" does not exist" entryPointName=http routerName=wp-t-01@docker
traefik | time="2020-11-03T14:56:37+01:00" level=error msg="middleware \"https-redirect@docker\" does not exist" entryPointName=http routerName=wp-d-01@docker
traefik | time="2020-11-03T14:56:37+01:00" level=error msg="unknown rule Path(`/mariadb-01`)" entryPointName=mysql routerName=mariadb-01@docker
Here is my Docker-Compose-File:
version: '3.5'
#################
# SERVICES #
#################
services:
######################
# Reverse Proxy #
######################
traefik-rp:
image: traefik:v2.3.2
container_name: traefik
restart: unless-stopped
security_opt:
# restricts root permissions and prevents the container from gaining such
- no-new-privileges:true
volumes:
# get time/location settings from host
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# access to docker daemon (required)
- /var/run/docker.sock:/var/run/docker.sock:ro
# mapping cert-files
- /certificates/certs_rp/:/certs/:ro
# mapping config files
- /docker-apps/traefik/config/dynamic.yml:/dynamic.yml:ro
- /docker-apps/traefik/config/traefik.yml:/traefik.yml:ro
networks:
- default
- traefik_proxy
command:
- "--configFile=./traefik.yml"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Path(`/traefik-admin`)"
- "traefik.http.routers.traefik.middlewares=https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Path(`/traefik-admin`)"
- "traefik.http.routers.traefik-secure.tls=true"
#################
# CON-MGMT #
#################
portainer:
image: portainer/portainer-ce:2.0.0-alpine
container_name: portainer-ce
restart: always
volumes:
# get time data from host
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# access to docker daemon (required)
- /var/run/docker.sock:/var/run/docker.sock
# mapping config files
- /docker-apps/portainer/data:/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.portainer.entrypoints=http"
- "traefik.http.routers.portainer.rule=Path(`/con-mgmt`)"
- "traefik.http.routers.portainer.middlewares=https-redirect"
- "traefik.http.routers.portainer2-secure.entrypoints=https"
- "traefik.http.routers.portainer-secure.rule=Path(`/con-mgmt`)"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
######################
# SQL-SERVER #
######################
mariadb-01:
image: mariadb:10.5 # EOL Jun 2025
container_name: mariadb-01
restart: unless-stopped
volumes:
- mariadb-01:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password
MYSQL_PASSWORD_FILE: /run/secrets/mysql_root_password
MYSQL_INITDB_SKIP_TZINFO: 1
secrets:
- mysql_root_password
labels:
- "traefik.enable=true"
- "traefik.tcp.routers.mariadb-01.entrypoints=mysql"
- "traefik.tcp.routers.mariadb-01.rule=Path(`/mariadb-01`)"
- "traefik.tcp.services.mariadb-01.loadbalancer.server.port=3306"
######################
# WordPress-t-01 #
######################
wp-t-01:
image: wordpress
restart: always
volumes:
- wp-t-01:/var/www/htm
networks:
- traefik_proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.wp-t-01.entrypoints=http"
- "traefik.http.routers.wp-t-01.rule=Path(`/wp-t-01`)"
- "traefik.http.routers.wp-t-01.middlewares=https-redirect"
- "traefik.http.routers.wp-t-01-secure.entrypoints=https"
- "traefik.http.routers.wp-t-01-secure.rule=Path(`/wp-t-01`)"
- "traefik.http.services.wp-t-01.loadbalancer.server.port=80"
######################
# WordPress-d-01 #
######################
wp-t-02:
image: wordpress
restart: always
volumes:
- wp-d-01:/var/www/htm
networks:
- traefik_proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.wp-d-01.entrypoints=http"
- "traefik.http.routers.wp-d-01.rule=Path(`/wp-d-02`)"
- "traefik.http.routers.wp-d-01.middlewares=https-redirect"
- "traefik.http.routers.wp-d-01-secure.entrypoints=https"
- "traefik.http.routers.wp-d-01-secure.rule=Path(`/wp-d-02`)"
- "traefik.http.services.wp-d-01.loadbalancer.server.port=80"
#################
# VOLUMES #
#################
volumes:
mariadb-01:
wp-t-01:
wp-d-01:
#################
# NETWORKS #
#################
networks:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
#################
# SECRETS #
#################
secrets:
mysql_root_password:
file: /docker-apps/.secrets/mysql_root_password
Here is my traefik.yml
The dasboard / insecure true setting is only enabled due to troubleshooting. Later on i will not neccesarely be needing the dashboard.
api:
dashboard: true
debug: true
insecure: true
entrypoints:
http:
address: :80
https:
address: :443
mysql:
address: :3306
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
network: traefik_proxy
file:
filename: "./dynamic.yml"
watch: true
Here is my dynamic.yml
(FYI - i replaced my real domain with domain.local)
http:
routers:
all-traffic-http-mgmt:
rule: "Host (`con-hst.domain.local`) || Host (`con-hst`)"
entryPoints:
- all-http
middleware:
- https-redirect
all-traffic-http-srv:
rule: "Host (`pwd-mgmt.domain.local`) || Host (`pwd-mgmt`)"
entryPoints:
- all-https
middleware:
- https-redirect
all-traffic-http-intranet:
rule: "Host (`intranet.domain.local`) || Host (`intranet`)"
entryPoints:
- all-https
middleware:
- https-redirect
middlewares:
https-redirect:
redirectscheme:
scheme: https
permanent: true
tls:
certficates:
- certFile: "/certs/cert-for-con-hst.crt"
keyFile: "/certs/keyfile-for-con-hst.key"
stores:
- default
certficates:
- certFile: "/certs/cert-for-pwd-mgmt.crt"
keyFile: "/certs/keyfile-for-pwd-mgmt.key"
certficates:
- certFile: "/certs/cert-for-intranet.crt"
keyFile: "/certs/keyfile-for-intranet.key"
stores:
default:
defaultCertificate:
certFile: "/certs/cert-for-con-hst.crt"
keyFile: "/certs/keyfile-for-con-hst.key"
I have spent quite a lot of time researching why my configuration isn't working. Either I am just to blind to see it or i completly misunderstood parts of the documentation.
Hope you guys can help me out.
Cheers.