PG::ConnectionBad: could not connect to server: Connection refused


(Jonathan Lin) #1

I want to setup separate data and web containers in one server.

In my data container config, I have:

expose:
  # Using linking in web
  #- "5432:5432"
  #- "6379:6379"
  - "127.0.0.1:2221:22"

as recommended here to prevent the need for port exposure and iptables tinkering: How to use Docker multiple containers without exposing ports

Then, in my web container, I have:

links:
  - link:
      name: data
      alias: data

as recommended by Linking containers for a multiple container setup, as well as:

  DISCOURSE_DB_HOST: data
  DISCOURSE_REDIS_HOST: data

But when I try to bootstrap the web container, I am getting:

PG::ConnectionBad: could not connect to server: Connection refused
	Is the server running on host "data" (172.17.0.58) and accepting
	TCP/IP connections on port 5432?

My data container is already up and running, though. What did I miss?


(Jonathan Lin) #2

Looks like rebuilding the data container did some wonders.


(Sam Saffron) #3