docker container geändert
This commit is contained in:
@@ -35,5 +35,6 @@ gitea
|
||||
local content share
|
||||
it-tools
|
||||
passbolt
|
||||
docuseal
|
||||
|
||||
|
||||
|
||||
@@ -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.<application router>.loadbalancer.server.port=<application port>"
|
||||
- "traefik.docker.network=<traefik_relay 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.
|
||||
|
||||
Reference in New Issue
Block a user