{"id":17132181,"url":"https://github.com/bitsofinfo/traefik-consul-docker-issue-01","last_synced_at":"2026-02-04T15:40:09.839Z","repository":{"id":146759377,"uuid":"94462372","full_name":"bitsofinfo/traefik-consul-docker-issue-01","owner":"bitsofinfo","description":"Attempt to have traefik gets its config from both consul and docker swarm","archived":false,"fork":false,"pushed_at":"2017-06-15T18:01:17.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T05:18:39.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitsofinfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-06-15T17:19:13.000Z","updated_at":"2017-12-14T19:01:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"79a7f156-0a93-4992-bb82-68a70f7fd895","html_url":"https://github.com/bitsofinfo/traefik-consul-docker-issue-01","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitsofinfo/traefik-consul-docker-issue-01","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Ftraefik-consul-docker-issue-01","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Ftraefik-consul-docker-issue-01/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Ftraefik-consul-docker-issue-01/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Ftraefik-consul-docker-issue-01/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitsofinfo","download_url":"https://codeload.github.com/bitsofinfo/traefik-consul-docker-issue-01/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Ftraefik-consul-docker-issue-01/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262978597,"owners_count":23394010,"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":[],"created_at":"2024-10-14T19:26:18.476Z","updated_at":"2026-02-04T15:40:04.820Z","avatar_url":"https://github.com/bitsofinfo.png","language":null,"readme":"# traefik-consul-docker-issue-01\n\nhttps://github.com/containous/traefik/issues/1727\n\nAttempt to have traefik gets its config from both consul and docker swarm, does not appear to work.\n\n1. Create docker network\n\n`docker network create -d overlay --attachable my-net`\n\n2. Start consul locally\n\n```\ndocker service create \\\n  --publish 8400:8400 \\\n  --publish 8500:8500 \\\n  --network my-net \\\n  --name consul \\\n  progrium/consul \\\n  -server \\\n  -bootstrap \\\n  -ui-dir /ui\n```\n\n3. Ensure consul is up at http://localhost:8500, then make sure you are in this project's root and upload `example.toml` to consul\n\n```\nexport CDIR=`pwd`\ndocker run \\\n -v $CDIR/example.toml:/etc/traefik/traefik.toml  \\\n --network my-net \\\n traefik \\\n storeconfig \\\n --consul \\\n --consul.endpoint=consul:8500 \\\n --consul.prefix=\"traefik-stage\"\n ```\n\n4. At this point the traefik config should be uploaded at: http://localhost:8500/ui/#/dc1/kv/traefik-stage/. Next Start traefik docker service\n\n ```\n docker service create \\\n--name traefik \\\n--constraint=node.role==manager \\\n--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \\\n--network my-net \\\n --publish 80:80 \\\n--publish 8080:8080 \\\ntraefik  \\\n--consul \\\n--consul.endpoint=consul:8500 \\\n--consul.prefix=traefik-stage\n```\n\n5. Start nginx service\n\n```\ndocker service create \\\n  --name nginx1 \\\n  --publish :80 \\\n  --label traefik.protocol=http \\\n  --label traefik.port=80 \\\n  --label traefik.frontend.rule='Host:mytest.mydomain1.com' \\\n  --label traefik.docker.network=my-net \\\n  --network my-net \\\n  nginx\n```\n\nAt this point the traefik logs will properly show it creating the frontend/backends and routes for the nginx1 service that was detected from docker\n\n```\n2017-06-15T18:00:37.559825827Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Configuration received from provider docker: {\"backends\":{\"backend-nginx1\":{\"servers\":{\"server-nginx1-1\":{\"url\":\"http://10.0.4.7:80\",\"weight\":0}},\"loadBalancer\":{\"method\":\"wrr\"}}},\"frontends\":{\"frontend-Host-mytest-mydomain1-com\":{\"entryPoints\":[\"http\"],\"backend\":\"backend-nginx1\",\"routes\":{\"route-frontend-Host-mytest-mydomain1-com\":{\"rule\":\"Host:mytest.mydomain1.com\"}},\"passHostHeader\":true,\"priority\":0,\"basicAuth\":[]}}}\"\n2017-06-15T18:00:37.559845503Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Last docker config received more than 2s, OK\"\n2017-06-15T18:00:37.560149444Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Creating frontend frontend-Host-mytest-mydomain1-com\"\n2017-06-15T18:00:37.560187299Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Wiring frontend frontend-Host-mytest-mydomain1-com to entryPoint http\"\n2017-06-15T18:00:37.560207175Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Creating route route-frontend-Host-mytest-mydomain1-com Host:mytest.mydomain1.com\"\n2017-06-15T18:00:37.560226652Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Creating backend backend-nginx1\"\n2017-06-15T18:00:37.560460975Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Creating load-balancer wrr\"\n2017-06-15T18:00:37.560497731Z time=\"2017-06-15T18:00:37Z\" level=debug msg=\"Creating server server-nginx1-1 at http://10.0.4.7:80 with weight 0\"\n2017-06-15T18:00:37.560517608Z time=\"2017-06-15T18:00:37Z\" level=info msg=\"Server configuration reloaded on :80\"\n```\n\nHowever if you go to the traefik dashboard at http://localhost:8080 nothing is displayed\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitsofinfo%2Ftraefik-consul-docker-issue-01","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitsofinfo%2Ftraefik-consul-docker-issue-01","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitsofinfo%2Ftraefik-consul-docker-issue-01/lists"}