# Starting Discourse on a Specific Docker Network

**URL:** https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401
**Category:** Support
**Created:** [2016年八月29日 18:32 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401 "2016-08-29T18:32:21Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![dlynch158](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@dlynch158](https://meta.discourse.org/u/dlynch158)
#### Post date: [2016年八月29日 18:32 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/1 "2016-08-29T18:32:21Z")

</div>

I can run `docker network connect squadwars web_only` and then `docker network inspect squadwars` and see it connected to my squadwars network.

But if I do:

./launcher start web\_only --docker-args=“–network squadwars” it doesn’t seem to connect itself to that network! (And yes I destroyed the container first).

I don’t see my options being passed to the docker run command.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [2016年八月29日 21:51 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/2 "2016-08-29T21:51:42Z")

</div>

Try running `/bin/bash -x ./launcher <etc etc>`, and trace where the `--docker-args` (and, subsequently, `$user_args`) gets set and used.

---

<div class="post-metadata">

### Author: ![dlynch158](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@dlynch158](https://meta.discourse.org/u/dlynch158)
#### Post date: [2016年八月29日 22:45 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/3 "2016-08-29T22:45:58Z")

</div>

> root@squadwars:/var/discourse# /bin/bash -x ./launcher start web\_only --docker-args=“–network squadwars” 2\>&1 | grep -C 15 args
> 
> - command=start
> - config=web\_only
> - user\_args=
> - ‘[’ 3 -gt 0 ‘]’
> - case “${1}” in
> - shift 1
> - ‘[’ 2 -gt 0 ‘]’
> - case “${1}” in
> - shift 1
> - ‘[’ 1 -gt 0 ‘]’
> - case “${1}” in
> - shift 1
> - ‘[’ 0 -gt 0 ‘]’  
> …  
> ++ cat containers/web\_only.yml
> - docker\_args=

Not really sure how to interpret this but it doesn’t seem to be parsing the --docker-args option.

---

<div class="post-metadata">

### Author: ![dlynch158](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@dlynch158](https://meta.discourse.org/u/dlynch158)
#### Post date: [2016年八月29日 22:57 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/4 "2016-08-29T22:57:27Z")

</div>

It looks like I can specify docker args in web\_only.yml though, do you know the syntax for that?

Edit: Okay the syntax was really easy, just:

docker\_args: “–network squadwars”

Now it’s working fine, thank you. (Still doesn’t work from commandline but I don’t care :))

Edit: Well the squadwars network is working fine, but discourse seems to be broken. I’m going to try to add it onto the host network as well, not sure if that works.

---

<div class="post-metadata">

### Author: ![deargle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deargle/32/120295_2.png) [@deargle](https://meta.discourse.org/u/deargle)
#### Post date: [2019年一月31日 06:53 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/5 "2019-01-31T06:53:00Z")

</div>

I just got this working with a web\_only container, a data container, and nginx-proxy in front, all on the same user-defined network.

With the web\_only template, the network needs to be specified in the user args on the command line because at least [one of the lines](https://github.com/discourse/discourse_docker/blob/737e65344795e592ca053908269819b93804720d/launcher#L640) that runs the base docker image does not include $docker\_args, while that line does include $user\_args.

Like: `./launcher rebuild web_only --docker-args '--network nginx-proxy'`

I also had that set in `docker_args:` in web\_only.yml:

```plaintext
docker_args:
  - '--network nginx-proxy'

```

I know this is an old topic, but google brought me here, and google knows all.

@mpalmer would it be not good to include $docker\_args on L640?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2019年二月1日 03:32 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/6 "2019-02-01T03:32:39Z")

</div>

Looks like on oversight to me, feel free to send through a PR

---

<div class="post-metadata">

### Author: ![deargle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deargle/32/120295_2.png) [@deargle](https://meta.discourse.org/u/deargle)
#### Post date: [2019年二月1日 04:42 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/7 "2019-02-01T04:42:12Z")

</div>

My holistic comprehension of launcher is weak, but I think that perhaps the cleanest thing would be to merge `$user_args` with `$docker_args`?

- `$user_args` comes from the command-line flag `--docker-args`, and `$docker_args` comes from the config file yaml entry for `docker_args:`.
- The `$docker_args` var is only used once in the entire launcher script (alongside `$user_args`, while `$user_args` is used in all run invocations that I see.

Does merging `$user_args` and `$docker_args` into one `$user_args` var sound okay?

PS happy anniversary!

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2019年二月1日 04:45 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/8 "2019-02-01T04:45:27Z")

</div>

Yeah it feels like both should be merged. I do not follow why we need 2 flavors for the same coke.

---

<div class="post-metadata">

### Author: ![deargle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deargle/32/120295_2.png) [@deargle](https://meta.discourse.org/u/deargle)
#### Post date: [2019年二月11日 21:42 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/9 "2019-02-11T21:42:36Z")

</div>

see [merge docker\_args with user\_args for launcher file by deargle · Pull Request #419 · discourse/discourse\_docker · GitHub](https://github.com/discourse/discourse_docker/pull/419), sorry for delay

---

<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: [2022年三月2日 06:55 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/10 "2022-03-02T06:55:33Z")

</div>



---

<div class="post-metadata">

### Author: ![osioke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osioke/32/238946_2.png) [@osioke](https://meta.discourse.org/u/osioke)
#### Post date: [2022年三月2日 06:57 UTC](https://meta.discourse.org/t/starting-discourse-on-a-specific-docker-network/49401/11 "2022-03-02T06:57:54Z")

</div>


