Linking containers

What is correct way to connect web-only and data Discourse docker containers?

There is note about DISCOURSE_HOST_IP in readme, but how should we specify that variable in container config yml file? Can we just link that images together?

What you do is expose the port on the host, then you can easily connect to it from any container.

The “expose” section in the yml takes care of it:

expose:
  - "5432:5432"
  - "6379:6379"
  - "2221:22"

Then all you need to do is plug in local machine ip here:

https://github.com/discourse/discourse_docker/blob/master/samples/web_only.yml#L19-L26

Hmm… but what is YOUR_IP_ADDRESS here? The external IP of the server (I guess not), or the variable DISCOURSE_HOST_IP?

I want to use web_only.yml and have a central redis and postgresql service on my server running.

1 Like

It really depends on how you set up your server. Try running ifconfig

I think you should be able to use docker0 for this. 172.17.42.1

1 Like

You’re right, it’s that IP address. On both sites. Thanks.

Last question (I think): what to use for DISCOURSE_DB_SOCKET? It should point to the socket of the host, but will it have access to it?

And why set a pasword if not setting a user variable?