Created
April 18, 2023 09:44
-
-
Save sujaykumarh/fe7aca2830c75d19bd8e4d2d19a10795 to your computer and use it in GitHub Desktop.
simple traefik server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: traefik | |
services: | |
traefik: | |
image: traefik:${TRAEFIK_VER:-v2.9} | |
container_name: traefik | |
restart: unless-stopped | |
command: | |
# - --api.insecure=true # for testing | |
- --api.dashboard=true # enable traefik dashboard | |
- --api.debug=false # enable api debug | |
- --providers.docker=true # type of loadbalancer | |
- --providers.docker.exposedbydefault=false # Expose containers by default through Traefik. https://doc.traefik.io/traefik/providers/docker/#exposedbydefault | |
- --entrypoints.http.address=:80 | |
- --accesslog # eanble traefik access log https://doc.traefik.io/traefik/observability/access-logs/#access-logs | |
- --log # enable traefik logger | |
- --api # enable traefik api | |
labels: | |
traefik.enable: "true" | |
traefik.docker.network: traefik-public | |
traefik.http.routers.traefik-public-http.entrypoints: http | |
traefik.http.routers.traefik-public-http.service: api@internal | |
traefik.http.routers.traefik-public-http.middlewares: admin-auth | |
traefik.http.routers.traefik-public-http.rule: Host(`${TRAEFIK_DOMAIN:-traefik.localhost}`) | |
traefik.http.middlewares.admin-auth.basicauth.users: ${ADMIN_USER}:${HASHED_PASSWORD} | |
traefik.http.services.traefik-public.loadbalancer.server.port: "${DASH_PORT:-8080}" | |
networks: | |
traefik-public: null | |
ports: | |
- mode: ingress | |
target: 80 | |
published: "80" | |
protocol: tcp | |
volumes: | |
- type: bind | |
source: /var/run/docker.sock | |
target: /var/run/docker.sock | |
read_only: true | |
bind: | |
create_host_path: true | |
- /etc/localtime:/etc/localtime:ro | |
- ./config.yml:/config.yml:ro | |
- /var/log/traefik-server:/etc/traefik/logs:Z | |
networks: | |
traefik-public: | |
name: traefik-public |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment