Example for traefik #86
-
I've noticed
Does someone have a working traefik example to share, which shows how to configure this to allow traefik with the access it needs, but without exposing everything? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
https://github.com/htpcBeginner/docker-traefik/blob/master/docker-compose-t2.yml |
Beta Was this translation helpful? Give feedback.
-
Here's an minimum required example I just got working off the back of the above link: networks:
default:
driver: bridge
socket_proxy:
name: socket_proxy
driver: bridge
# ⬇ Run "docker network create web" to create - attach other services you want to serve through traefik to this network
web:
external: true
services:
reverse-proxy:
image: traefik:v3.1
container_name: traefik
restart: always
command:
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.endpoint=tcp://socket-proxy:2375"
- "--providers.docker.exposedByDefault=false"
- "--providers.docker.network=web"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
networks:
- web
- socket_proxy
labels:
- "traefik.enable=true"
# ⬇ Serves your Traefik dashboard on http://traefik.localhost
- "traefik.http.routers.traefik-rtr.entrypoints=web"
- "traefik.http.routers.traefik-rtr.rule=Host(`traefik.localhost`)"
- "traefik.http.routers.traefik-rtr.service=traefik-svc"
- "traefik.http.services.traefik-svc.loadbalancer.server.port=8080"
depends_on:
- socket-proxy
socket-proxy:
image: tecnativa/docker-socket-proxy
container_name: socket-proxy
restart: unless-stopped
networks:
- socket_proxy
ports:
- "2375:2375"
security_opt:
- no-new-privileges:true
environment:
- CONTAINERS=1
volumes:
- "/var/run/docker.sock:/var/run/docker.sock" |
Beta Was this translation helpful? Give feedback.
https://github.com/htpcBeginner/docker-traefik/blob/master/docker-compose-t2.yml