{"id":21652149,"url":"https://github.com/bitroniq/docker-compose-traefik","last_synced_at":"2025-10-07T11:36:26.785Z","repository":{"id":68694553,"uuid":"155386955","full_name":"bitroniq/docker-compose-traefik","owner":"bitroniq","description":"Docker compose and configuration to setup traefik ingress for web traffic","archived":false,"fork":false,"pushed_at":"2022-11-15T12:55:51.000Z","size":275,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T16:44:44.480Z","etag":null,"topics":["docker-compose","doocker","traefik","traefik-ingress"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitroniq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T13:06:53.000Z","updated_at":"2023-01-05T02:37:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0376fd1-7f53-4d73-97f1-68a903c45cd5","html_url":"https://github.com/bitroniq/docker-compose-traefik","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitroniq%2Fdocker-compose-traefik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitroniq%2Fdocker-compose-traefik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitroniq%2Fdocker-compose-traefik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitroniq%2Fdocker-compose-traefik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitroniq","download_url":"https://codeload.github.com/bitroniq/docker-compose-traefik/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248476797,"owners_count":21110357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","doocker","traefik","traefik-ingress"],"created_at":"2024-11-25T07:51:25.149Z","updated_at":"2025-10-07T11:36:21.760Z","avatar_url":"https://github.com/bitroniq.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker compose traefik\n\u003e Docker compose and configuration to setup traefik ingress for web traffic\n\n[![LICENSE][license-image]][license-url]\n\nThis docker-compose.yml uses [traefik](https://traefik.io/) - \"The Cloud Native Edge Router\".\n\n\u003e Traefik is a reverse proxy / load balancer that's easy, dynamic, automatic, fast, full-featured, open source, production proven, provides metrics, and integrates with every major cluster technologies... No wonder it's so popular!\n\nThe configuration bases on docs that can be found on the traefik project website - [Docker-compose with let's encrypt : HTTP Challenge](https://doc.traefik.io/traefik/user-guides/docker-compose/acme-http/)\n\n## Main functions\n* Use Traefik as a layer-7 load balancer\n* SSL termination for a set of micro-services and/or web apps\n* Automatic discovery of any services on the Docker host\n* Traefik reconfigure itself automatically when containers get created (or shut down)\n* HTTP traffic can be routed accordingly based on automatic reconfiguration\n* Let's Encrypt to automatically generate and renew SSL certificates per hostname\n\n![](traefik-dashboard.png)\n\n## Setup\n\n* Server with public IP\n* Install latest Docker (i.e. [Get Docker CE for Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/))\n  - [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/)\n* Install latest [Docker Compose](https://docs.docker.com/compose/install/#install-compose)\n* Configure your domain to point to your IP, i.e. `my-test-domain.com`\n  - use also wildcard `CNAME` `*` is an alias `my-test-domain.com`\n\n## Usage example\n\nNow create directory for traefik:\n```sh\ncd ~\nmkdir sites\ncd sites\ngit clone https://github.com/bitroniq/docker-compose-traefik.git\ncd docker-compose-traefik\n```\n\nThe `docker-compose.yml` provides simple way to create immutable Traefik container.\n\nAll configration is provided inside `docker-compose.yml`\n\nMounting the `/var/run/docker.sock` Docker socket in the container allows Traefik to listen to Docker events and reconfigure its own internal configuration when containers are created (or shut down).\n\n## Customize the docker-compose.yml\n\n1. Replace postmaster@example.com by your own email within the `certificatesresolvers.myresolver.acme.email` command line argument of the traefik service.\n2. Replace `whoami.example.com` by your own domain within the `traefik.http.routers.whoami.rule` label of the whoami service.\n3. Optionally uncomment the following lines if you want to test/debug:\n   - `#- \"--log.level=DEBUG\"`\n   - `#- \"--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory\"`\n\n## Running traefik\n\nTo boot the container from the `~/sites/docker-compose-traefik` directory, run:\n```sh\ndocker-compose up -d\n```\nNow you can open your browser and go to `http://localhost:8080` to see the Traefik Dashboard.\n\n\n## Checking the logs\n\n```\nroot@ubuntu-s-1vcpu-1gb-amd-fra1-01:~/docker-compose-traefik# docker-compose logs -f\nAttaching to simple-service, traefik\nsimple-service | 2022/11/15 12:26:52 Starting up on port 80\ntraefik    | time=\"2022-11-15T12:26:52Z\" level=info msg=\"Configuration loaded from flags.\"\n```\n\n## Dashboard Screenshots\n\n\n![](traefik-dashboard.png)\n\n![](traefik-dashboard-2.png)\n\n![](traefik-dashboard-3.png)\n\n## Final verification\n\n![](traefik-whoami.png)\n\n## Web apps and websites reconfiguration to expose via Traefik\n\nThe only things that must be changed in typical `docker-compose.yml` are:\n* to remove the ports exposing definitions (Traefik will expose what is needed automatically)\n* add traefik labels - Traefik needs to know which Layer 7 `Host` must be used for routing traffic\n\nExample - Simple apache `docker-compose.yml`:\n\n```yml\nversion: '2'\n\nservices:\n  apache:\n    image: 'bitnami/apache:latest'\n    labels:\n      - \"traefik.enabled=true\"\n      - \"traefik.frontend.rule=Host:fileserver.my-test-domain.com\"\n    volumes:\n      - ./html:/app\n    restart: always\n```\n\n## Global HTTP to HTTPS redirect\n\nThe easiest way is to redirect to HTTPS globally. Once configured all your running services will use it.\n\nThe configuration of Traefik is displayed in the following code block.\n\nThe web entrypoint additionally has a redirection to the websecure entrypoint.\n\nThe scheme is defined as https, a predefined scheme by Traefik which automatically turns HTTP into HTTPS.\n\nThis results in all traffic coming in at port 80 being redirected to port 443 - the default HTTPS port.\n\n```yml\n  traefik:\n  ...\n    command:\n    ...\n      - \"--entrypoints.web.address=:80\"\n      - \"--entrypoints.websecure.address=:443\"\n      - \"--entrypoints.web.http.redirections.entrypoint.to=websecure\"\n      - \"--entrypoints.web.http.redirections.entrypoint.scheme=https\"\n      ...\n```\n\n## Release History\n\n### [Unreleased]\n\n### [v2.0] - 2022-11-15\n#### Updated\n- Updated Screenshots\n- Updated docker-compose\n- Upgrade to Traefik 2.9\n\n### [v1.1] - 2018-07-17\n#### Fixed\n- Fixed some typos\n\n#### Added\n- Something\n\n### [v1.0] - 2018-07-17\n#### Fixed\n- Some typos\n\n[Unreleased]: https://github.com/bitroniq/docker-compose-traefik/compare/v2.0...HEAD\n[v2.0]: https://github.com/bitroniq/docker-compose-traefik/compare/v1.1...v2.0\n[v1.1]: https://github.com/bitroniq/docker-compose-traefik/compare/v1.0...v1.1\n[v1.0]: https://github.com/bitroniq/docker-compose-traefik/compare/ff494e6...v1.0\n\n---\n\n## Meta\n\nPiotr Kowalski – [@YourTwitter](https://twitter.com/YourLoign) – YourEmail@example.com\n\nDistributed under the GNU GPL license. See ``LICENSE`` for more information.\n\n[https://github.com/bitroniq/docker-compose-traefik](https://github.com/bitroniq/docker-compose-traefik)\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/bitroniq/docker-compose-traefik/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n[license-image]: https://img.shields.io/badge/license-GPL-brightgreen.svg\n[license-url]: https://raw.githubusercontent.com/bitroniq/docker-compose-traefik/master/LICENSE\n[wiki]: https://github.com/bitroniq/docker-compose-traefik/wiki\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitroniq%2Fdocker-compose-traefik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitroniq%2Fdocker-compose-traefik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitroniq%2Fdocker-compose-traefik/lists"}