Linking containers


(resure) #1

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?


(Sam Saffron) #2

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:


(Sander Datema) #3

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.


(Sam Saffron) #4

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


(Sander Datema) #5

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


(Sander Datema) #6

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?