# Traefik に関する議論 🐁

**URL:** https://meta.discourse.org/t/discourse-behind-traefik/84874
**Category:** Self-hosting
**Created:** [2018 年 4 月 9 日午前 11:33 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874 "2018-04-09T11:33:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Cerix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cerix/32/94018_2.png) [@Cerix](https://meta.discourse.org/u/Cerix)
#### Post date: [2018 年 4 月 9 日午前 11:33 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/1 "2018-04-09T11:33:05Z")

</div>

Hello guys, I’m trying to install Discourse behind Traefik which is used as reverse proxy,  
The problem is that when creating the container I need to specify some parameters such as:

```
labels:
      - traefik.backend=discourse <== this must be the service name I do not know which one is the default, i think is "app"?
      - traefik.frontend.rule=Host:meta.mydomain.org
      - traefik.docker.network=web
      - traefik.port=80
    networks:
         - web

```

I tried to insert these parameters in the app.yml file but when I run "./launcher rebuild app " I get error “invalid reference format: repository name must be lowercase”

I’m sorry, but I’m not a real docker and discourse expert, so if you can kindly help me I’d appreciate it.

---

<div class="post-metadata">

### Author: ![Cerix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cerix/32/94018_2.png) [@Cerix](https://meta.discourse.org/u/Cerix)
#### Post date: [2018 年 4 月 9 日午後 2:45 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/2 "2018-04-09T14:45:24Z")

</div>

ok the correct way to insert labels is:

```
labels:
  traefik.port: "80"
  traefik.backend: "app"
  traefik.frontend.rule: "Host:meta.mydomain.org"
  traefik.docker.network: "web"

```

last problem is to start the container in a specific network does anyone have any advice?

if i add

```
networks:
 - web

```

seems to be ignored

---

<div class="post-metadata">

### Author: ![Cameron\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cameron_d/32/97535_2.png) [@Cameron\_D](https://meta.discourse.org/u/Cameron_D)
#### Post date: [2018 年 4 月 9 日午後 9:39 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/3 "2018-04-09T21:39:52Z")

</div>

The app.yml isn’t a docker-compose file, you need to pass the labels through the docker-args parameter, something like:

`./launcher start app --docker-args '-l "traefik.a.b=c" -l "traefik.x.y=z"'`

I think. You can also add them in a new section in the app.yml file, but I’m not sure of the syntax (look at `samples/web_only.yml`, there’s a commented out docker\_args section).

Edit: just re-read the docs and I see what you say about a labels section. I wonder why that doesn’t work

---

<div class="post-metadata">

### Author: ![Cerix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cerix/32/94018_2.png) [@Cerix](https://meta.discourse.org/u/Cerix)
#### Post date: [2018 年 4 月 10 日午後 2:01 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/4 "2018-04-10T14:01:33Z")

</div>

OK problem solved!

edit you app.yml add traefik labels like this:

```
expose:
     - "80"
     - "443"

labels:
      - traefik.backend="app"
      - traefik.frontend.rule=Host:meta.mydomain.org
      - traefik.docker.network=web
      - traefik.port=80

```

after run:  
`$ ./launcher rebuil app`

connect the container to your network:

`$ docker network connect web app`

Enjoy Discourse!

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2018 年 4 月 10 日午後 5:16 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/5 "2018-04-10T17:16:58Z")

</div>

@sam there’s been a couple people trying this, a yml section for `docker network connect` might be a good idea

---

<div class="post-metadata">

### Author: ![huberfe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/huberfe/32/87242_2.png) [@huberfe](https://meta.discourse.org/u/huberfe)
#### Post date: [2018 年 6 月 3 日午前 6:01 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/6 "2018-06-03T06:01:22Z")

</div>

If anyone with traefik would share how they setup their app.yml i’d appreciate it.

Trying @Cerix’s solution seems not to work. I tried multiple times now but can’t get it to run.

Getting: `“invalid reference format: repository name must be lowercase”`

---

<div class="post-metadata">

### Author: ![Cameron\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cameron_d/32/97535_2.png) [@Cameron\_D](https://meta.discourse.org/u/Cameron_D)
#### Post date: [2018 年 6 月 3 日午前 6:30 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/7 "2018-06-03T06:30:27Z")

</div>

I never got the labels section working, so I just have a docker\_args section that looks like this:

```yaml
docker_args:
  - "--network=web"
  - "--expose=80"
  - "-l traefik.backend=forums"
  - "-l traefik.frontend.rule=Host:forums.domain.com,cf-cdn.domain.com"
  - "-l traefik.docker.network=web"
  - "-l traefik.port=80"

```

Not necessarily elegant, but it works.

---

<div class="post-metadata">

### Author: ![huberfe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/huberfe/32/87242_2.png) [@huberfe](https://meta.discourse.org/u/huberfe)
#### Post date: [2018 年 6 月 3 日午前 7:17 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/8 "2018-06-03T07:17:24Z")

</div>

This worked very well!  
Thank you very much

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年 4 月 16 日午前 9:45 UTC](https://meta.discourse.org/t/discourse-behind-traefik/84874/9 "2019-04-16T09:45:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
