Hi All,
I have installed Traefik docker in my Ubuntu Server using the following docker-compose file:
#traefik docker-compose file
version: '3.7'
services:
traefik:
hostname: traefik
image: traefik:1.7
container_name: traefik
restart: always
domainname: ${DOMAINNAME}
networks:
- default
- traefik_proxy
ports:
- "80:80"
- "443:443"
- "8080:8080"
environment:
- DUCKDNS_TOKEN=${DUCKDNS_TOKEN}
- TZ=Asia/Jerusalem
labels:
- "traefik.enable=true"
- "traefik.backend=traefik"
- "traefik.frontend.rule=Host:traefik.${DOMAINNAME}"
- "traefik.port=8080"
- "traefik.docker.network=traefik_proxy"
- "traefik.frontend.headers.SSLRedirect=true"
- "traefik.frontend.headers.STSSeconds=315360000"
- "traefik.frontend.headers.browserXSSFilter=true"
- "traefik.frontend.headers.contentTypeNosniff=true"
- "traefik.frontend.headers.forceSTSHeader=true"
- "traefik.frontend.headers.SSLHost=${DOMAINNAME}"
- "traefik.frontend.headers.STSIncludeSubdomains=true"
- "traefik.frontend.headers.STSPreload=true"
- "traefik.frontend.headers.frameDeny=true"
# - "com.ouroboros.enable=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ../traefik:/etc/traefik
- ./shared:/shared
- ./traefik.toml:/traefik.toml
- ./rules.toml:/etc/traefik/rules.toml
healthcheck:
test: ["CMD", "/traefik", "healthcheck"]
interval: 30s
timeout: 3s
retries: 30
networks:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
I have already created a network traefik_proxy
sudo docker network create traefik_proxy
I have an .env file contained with ${DOMAINNAME}
and ${DUCKDNS_TOKEN}
# .env file for my docker-compose
DUCKDNS_TOKEN=b7xxxxxb-fxx8-4xx7-8xx9-5xxxxxxxxxx6
DOMAINNAME=mydomain.duckdns.org
and I have ran the command sudo docker-compose config
without any errors at all.
- I do have a concern regarding the network.
I also have createdtraefik.toml
file with my settings.
# traefik.toml file
logLevel = "DEBUG"
defaultEntryPoints = ["https", "http"]
[api]
entryPoint = "traefik"
dashboard = true
address = ":8080"
[ping]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
#permanent = true
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.traefik]
address = ":8080"
[entryPoints.traefik.auth]
[entryPoints.traefik.auth.basic]
usersFile = "/shared/.htpasswd"
[file]
watch = true
filename = "/etc/traefik/rules.toml"
# Let's encrypt configuration
[acme]
email = "arye.myemail@gmail.com" #any email id will work
storage="/acme.json"
entryPoint = "https"
acmeLogging = true
#onDemand = false #create certificate when container is created
[acme.dnsChallenge]
provider = "duckdns"
delayBeforeCheck = 300
[[acme.domains]]
main = "mydomain.duckdns.org"
[[acme.domains]]
main = "*.mydomain.duckdns.org"
# Connection to docker host system (docker.sock)
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "mydomian.duckdns.org"
watch = true
# This will hide all docker containers that don't have explicitly
# set label to "enable"
exposedbydefault = false
I have created the following files as well
rules.toml
and acme.json
also created the folder shared under traefik main folder
**# ls of my traefik folder on Ubuntu**
---------------------------------------------------------------
drwxr-xr-x 3 root root 4096 Mar 30 09:56 .
drwxrwxr-x 30 arye arye 4096 Mar 30 09:33 ..
-rw------- 1 root root 22951 Mar 29 20:58 acme.json
-rw-r--r-- 1 root root 1609 Mar 30 09:53 docker-compose.yaml
-rw-r--r-- 1 root root 85 Mar 30 08:40 .env
-rw-r--r-- 1 root root 0 Mar 29 16:49 rules.toml
drwxr-xr-x 2 root root 4096 Mar 29 20:28 shared
-rw-r--r-- 1 root root 1503 Mar 30 09:12 traefik.toml
I have set sudo chmod 600 acme.json
As you can see above.
I have this file usersFile = "/shared/.htpasswd"
created and ready filled with my credentials.
That I have been able to log in to traefik dashboard. So i am sure that this file is OK
Here:
I am not sure what I am doing wrong since I am not getting anything in my acme.json
file at all
I have manged to run the traefik container and access it from https://traefik.mydomian.duckdns.org
But it stops there!
any other docker I add I am getting timeout
and I have made changes with the networking and I got bad gateway
as well.
I have been working on this for couple of days and I don't know what I did wrong?
Please do assist me and understand what is wrong with my settings?
I have tried to run my tasmoadmin docker using the following compose settings:
# tasmoadmin settings for traefik reverse proxy server
version: '3.7'
services:
tasmoadmin:
container_name: tasmoadmin
hostname: tasmoadmin
image: raymondmm/tasmoadmin:latest
volumes:
restart: always
ports:
- "5555:80"
volumes:
- ./data:/data
labels:
- "traefik.enable=true"
- "traefik.backend=tasmoadmin"
- "traefik.frontend.rule=Host:tasmoadmin.${DOMAINNAME}"
- "traefik.port=5555"
- "traefik.frontend.entryPoints=http,https"
networks:
- traefik_proxy
networks:
traefik_proxy:
external: true
Please assist me to make it running I would be happy to make it running asap since I have so many dockers that I want to implement with traefik server.
Thank you all in advanced!
Arye.