Linking containers

AI 生成的摘要

The discussion “Linking containers” revolves around connecting web-only and data Discourse Docker containers. resure inquired about the correct method to connect the containers and specify the DISCOURSE_HOST_IP variable in the container config yml file. sam suggested exposing the port on the host and connecting to it from any container using the “expose” section in the yml file.

sam further clarified that the YOUR_IP_ADDRESS variable should be set to the IP address of the Docker host, which can be found using ifconfig or using the docker0 IP address (172.17.42.1). Sander78 confirmed that this IP address should be used on both the web-only and data containers.

Sander78 also asked about setting the DISCOURSE_DB_SOCKET variable, questioning whether the container will have access to the host socket, and the purpose of setting a password without setting a user variable.

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:

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.

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

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?