Connection between two secondary containers

I have a primary container A, and two secondary containers B1 and B2, and both A and B1 need to connect to B2. Is there a way to make this work without using docker compose?

I’ve been trying to connect to localhost:5432 from B1, but that results in this error:

Could not connect to server: Connection refused\n\tIs the server running on host “localhost” ( and accepting\n\tTCP/IP connections on port 5432?

Any ideas?

This should work out of the box, can you share your entire CircleCI configuration?

This is my current configuration. I’ve checked the postgres instance, and it is ready to accept connections long before hasura attempts to connect, but hasura still fails connect.

version: 2
  - &TEST_RESULTS ./test-results/


      - image: circleci/python:3.7.5
      - image: circleci/postgres:9.6-alpine-ram
          POSTGRES_USER: db_master_user
          POSTGRES_DB: db_test
          POSTGRES_PASSWORD: db_password
      - image: hasura/graphql-engine:latest
        name: hasura
        #        command: ["graphql-engine", "serve"]
        command: ["sh", "-c", "sleep 30 && graphql-engine serve"]
          HASURA_GRAPHQL_DATABASE_URL: postgres://db_master_user:db_password@localhost/db_test

      - checkout

      - restore_cache:
          key: v1-dependencies-{{ checksum "poetry.lock" }}

      - run:
          name: 'Wait for Hasura'
          command: dockerize -wait tcp://localhost:8080 -timeout 1m

Is there anything in the postgres container logs that could point to the issue?

I was able to get this working by specifying an explicit name for the postgres instance, instead of relying on the default, implicit localhost name. After naming it postgres, I was able to connect the hasura instance.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.