# Docker Traefik Proxy

Traefik ist ein moderner HTTP-Proxy und Load Balancer, der die Bereitstellung von Microservices vereinfacht.

Traefik integriert sich in Ihre bestehenden Infrastrukturkomponenten (Docker, Swarm-Modus, Kubernetes, Marathon, Consul, Etcd, Rancher, Amazon ECS, ...) und konfiguriert sich automatisch und dynamisch.

Wenn man Traefik auf Ihren Orchestrator richtet, sollte dies der einzige Konfigurationsschritt sein, den man dafür benötigt.

## Traefik v2 - Nutzungs-Beispiele

Den Docker-Provider und die Webbasierte Benutzeroberfläche öffnen:

```
## traefik.yml

# Docker configuration backend
providers:
  docker:
    defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)"

# API and dashboard configuration
api:
  insecure: true
```

Traefik starten:

```
docker run -d -p 8080:8080 -p 80:80 \
-v $PWD/traefik.yml:/etc/traefik/traefik.yml \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik:v2.5
```

Einen Backend-Server namens test starten:

```
docker run -d --name test traefik/whoami
```

Zum Schluss lässt sich dann der `whoami`-Server mit Traefik auf dem Domainnamen test.docker.localhost erreichen:

```
# $ curl --header 'Host:test.docker.localhost' 'http://localhost:80/'
$ curl test.docker.localhost
Hostname: 390a880bdfab
IP: 127.0.0.1
IP: 172.17.0.3
GET / HTTP/1.1
Host: test.docker.localhost
User-Agent: curl/7.65.3
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.17.0.1
X-Forwarded-Host: test.docker.localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 7e073cb54211
X-Real-Ip: 172.17.0.1
```

Die Benutzeroberfläche im Web auf <http://localhost:8080> wird dir eine Übersicht von allen Routern, Services und middlewares geben.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mc-host24.de/docs/docker/docker-traefik-proxy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
