Starting Discourse on a Specific Docker Network

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.

1 Like

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

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.

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.

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 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:

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?

5 Likes

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

1 Like

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!

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

2 Likes

see https://github.com/discourse/discourse_docker/pull/419, sorry for delay

5 Likes