tech:traefik_-_un_reverse_proxy_pour_docker
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:traefik_-_un_reverse_proxy_pour_docker [2025/11/11 18:49] – Jean-Baptiste | tech:traefik_-_un_reverse_proxy_pour_docker [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Traefik - un reverse proxy pour Docker | ||
| + | |||
| + | Voir aussi : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | `traefik.yml` | ||
| + | ~~~yaml | ||
| + | entryPoints: | ||
| + | web: | ||
| + | address: ": | ||
| + | websecure: | ||
| + | address: ": | ||
| + | |||
| + | serversTransport: | ||
| + | insecureSkipVerify: | ||
| + | # rootCAs: | ||
| + | # - certs/ | ||
| + | |||
| + | providers: | ||
| + | file: | ||
| + | filename: dynamic_conf.yml | ||
| + | watch: true | ||
| + | docker: | ||
| + | endpoint: " | ||
| + | exposedByDefault: | ||
| + | |||
| + | log: | ||
| + | #level: DEBUG | ||
| + | level: INFO | ||
| + | |||
| + | api: | ||
| + | dashboard: true | ||
| + | #debug: true | ||
| + | #insecure: true | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `dynamic_conf.yml` | ||
| + | ~~~yaml | ||
| + | tls: | ||
| + | certificates: | ||
| + | - certFile: certs/ | ||
| + | keyFile: certs/ | ||
| + | |||
| + | - certFile: certs/ | ||
| + | keyFile: certs/ | ||
| + | stores: | ||
| + | - default | ||
| + | |||
| + | stores: | ||
| + | default: | ||
| + | defaultCertificate: | ||
| + | certFile: certs/ | ||
| + | keyFile: certs/ | ||
| + | |||
| + | options: | ||
| + | default: | ||
| + | minVersion: VersionTLS12 | ||
| + | sniStrict: true | ||
| + | ~~~ | ||
| + | |||
| + | `docker-compose.yml` | ||
| + | ~~~yaml | ||
| + | version: ' | ||
| + | services: | ||
| + | traefik: | ||
| + | image: traefik | ||
| + | #restart: unless-stopped | ||
| + | ports: | ||
| + | - " | ||
| + | - " | ||
| + | volumes: | ||
| + | - / | ||
| + | - / | ||
| + | - $PWD/ | ||
| + | - $PWD/ | ||
| + | - $PWD/ | ||
| + | # environment: | ||
| + | # PUID: ${PUID} | ||
| + | # PGID: ${PGID} | ||
| + | # TZ: ${TZ} | ||
| + | labels: | ||
| + | - traefik.enable=true | ||
| + | - traefik.http.routers.dashboard.entrypoints=web | ||
| + | - traefik.http.routers.dashboard.rule=Host(`traefik.docker.local`) | ||
| + | #- traefik.http.services.s-dashboard.loadbalancer.server.port=8080 | ||
| + | - traefik.port=8080 | ||
| + | - traefik.http.routers.s-dashboard.entrypoints=websecure | ||
| + | - traefik.http.routers.s-dashboard.rule=Host(`traefik.docker.local`) | ||
| + | - traefik.http.routers.s-dashboard.service=api@internal | ||
| + | - traefik.http.routers.s-dashboard.middlewares=auth@docker | ||
| + | # mkpasswd -m md5 |sed -e ' | ||
| + | - traefik.http.middlewares.auth.basicauth.users=jean: | ||
| + | - traefik.http.routers.s-dashboard.tls=true | ||
| + | - traefik.http.routers.dashboard.middlewares=https-redirect@docker | ||
| + | - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https | ||
| + | - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true | ||
| + | |||
| + | # hello: | ||
| + | # image: osones/ | ||
| + | # labels: | ||
| + | # - traefik.enable=true | ||
| + | # - traefik.http.routers.hw.entrypoints=web | ||
| + | # - traefik.http.routers.hw.rule=Host(`hw.docker.local`) | ||
| + | # - traefik.http.routers.s-hw.entrypoints=websecure | ||
| + | # - traefik.http.routers.s-hw.rule=Host(`hw.docker.local`) | ||
| + | # - traefik.http.routers.s-hw.tls=true | ||
| + | # - traefik.http.routers.hw.middlewares=https-redirect@docker | ||
| + | # - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https | ||
| + | # - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true | ||
| + | # #- " | ||
| + | # #- " | ||
| + | |||
| + | redis: | ||
| + | image: redis | ||
| + | #restart: unless-stopped | ||
| + | restart: always | ||
| + | registry: | ||
| + | image: registry:2 | ||
| + | depends_on: | ||
| + | - redis | ||
| + | environment: | ||
| + | environment: | ||
| + | - REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/ | ||
| + | - REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR=redis | ||
| + | - REGISTRY_REDIS_ADDR=redis: | ||
| + | volumes: | ||
| + | - $PWD/ | ||
| + | labels: | ||
| + | - traefik.enable=true | ||
| + | - traefik.port=5000 | ||
| + | - traefik.http.routers.s-registry.rule=Host(`registry.docker.local`) | ||
| + | - traefik.http.routers.s-registry.entrypoints=websecure | ||
| + | - traefik.http.routers.s-registry.tls=true | ||
| + | |||
| + | registry-ui: | ||
| + | image: konradkleine/ | ||
| + | #restart: unless-stopped | ||
| + | depends_on: | ||
| + | - registry | ||
| + | environment: | ||
| + | ENV_DOCKER_REGISTRY_HOST: | ||
| + | ENV_DOCKER_REGISTRY_PORT: | ||
| + | # | ||
| + | ENV_DEFAULT_REPOSITORIES_PER_PAGE: | ||
| + | labels: | ||
| + | - traefik.enable=true | ||
| + | - traefik.port=80 | ||
| + | - traefik.http.routers.s-registry-ui.rule=Host(`registry-ui.docker.local`) | ||
| + | - traefik.http.routers.s-registry-ui.entrypoints=websecure | ||
| + | - traefik.http.routers.s-registry-ui.tls=true | ||
| + | - traefik.http.routers.s-registry-ui.middlewares=auth@docker | ||
| + | - traefik.http.middlewares.auth.basicauth.users=jean: | ||
| + | ~~~ | ||
| + | |||
| + | Exemple de génération de certificats. Notez que Traefik est capable d' | ||
| + | ~~~bash | ||
| + | mkdir certs | ||
| + | openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker-compose up -d | ||
| + | ~~~ | ||
