From d8337a485d62cd1f62bf82a775239d7df0810bf0 Mon Sep 17 00:00:00 2001 From: smad Date: Sun, 9 Nov 2025 06:32:43 +0100 Subject: [PATCH] =?UTF-8?q?docker=20container=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 20230417115712-list_of_docker_containers.org | 1 + 20230607154727-traefik_docker.org | 55 +++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/20230417115712-list_of_docker_containers.org b/20230417115712-list_of_docker_containers.org index 24991cc..4314a9f 100644 --- a/20230417115712-list_of_docker_containers.org +++ b/20230417115712-list_of_docker_containers.org @@ -35,5 +35,6 @@ gitea local content share it-tools passbolt +docuseal diff --git a/20230607154727-traefik_docker.org b/20230607154727-traefik_docker.org index 64b129c..bc3ee69 100644 --- a/20230607154727-traefik_docker.org +++ b/20230607154727-traefik_docker.org @@ -4,7 +4,7 @@ #+title: traefik_docker #+filetags: :docker: -Traefik is a reverse proxy for hosting various applications on [[id:80666401-173e-4828-9c29-552dab716946][dns]] entries. It is run as a [[id:df046fd7-1f82-4e12-9065-56d222f56408][docker]] container on the communikation [[id:80a4104e-af18-4d90-a45e-2c92b51e8c0c][server w10]]. To host a container in reverse proxy mode, the *tags* feature of docker containers. These tags have to be added to a container to uphost it. Those tags declare which type of hosting is wanted and what service/router is to be used. The traefik container needs access to [[id:f4bb4857-2112-4e10-a22e-6da1436ce7b7][port]] 80, 443 for hosting and port 8080 for the dashboard. +Traefik is a reverse proxy for hosting various applications on [[id:80666401-173e-4828-9c29-552dab716946][dns]] entries. It is run as a [[id:df046fd7-1f82-4e12-9065-56d222f56408][docker]] container on the communication [[id:80a4104e-af18-4d90-a45e-2c92b51e8c0c][server w10]]. To host a container in reverse proxy mode, the *tags* feature of docker containers. These tags have to be added to a container to uphost it. Those tags declare which type of hosting is wanted and what service/router is to be used. The traefik container needs access to [[id:f4bb4857-2112-4e10-a22e-6da1436ce7b7][port]] 80, 443 for hosting and port 8080 for the dashboard. * how to run traefik - create a ~traefik~ folder using ~mkdir~ @@ -142,3 +142,56 @@ Typical flags for hosting a container (under the labels section in a [[id:fcbfab - "traefik.http.services..loadbalancer.server.port=" - "traefik.docker.network=" #+end_src +* Traefik with dynamic config +Applications that cannot connect to the Traefik Docker network (i.e. non-Docker native applications) cannot use Docker labels. Therefore, Traefik configuration must be done in an external configuration file. This file is located in the same folder as the ~traefik.yml~ static configuration file. The file is called ~configuration.yml~. +#+begin_src bash +http: +############################### + routers: + dashboard: + rule: "Host(`example.exampledomain.de`)" || "Host(`example2.exampledomain2.com`)" + entrypoints: + - "websecure" + tls: true + service: api@internal +#-------------------------------- + app1: + rule: "Host(`app1.exampledomain.de`)" + entrypoints: + - "websecure" + tls: true + service: service1 +#-------------------------------- + app2: + rule: "Host(`app2.exampledomain.de`)" + entrypoints: + - "websecure" + tls: + certresolver: "production" + options: "modern@file" + middlewares: "default-security-headers@file" + service: service2 +############################# + services: + service1: + loadbalancer: + servers: + - url: "http://xxx.xxx.xxx.xxx:yy" + service2: + loadbalancer: + servers: + - url: "http://ooo.ooo.ooo.ooo:kk" +############################## + middlewares: + default-security-headers: + headers: + ... +############################## +############################## +tls: + options: + modern: + ... +#+end_src + +This file is built in the same way as flags in the Docker configuration, only written in a more readable format. The fact that the IP addresses of the hosted services are given here makes it possible to easily serve non-Docker native apps. As this file is dynamic, Traefik is updated automatically when you save it.