I’m building a Docker image using
setup_remote_docker but on the same run I have some dependencies that my image will need to access when I run that image.
This is what I have:
version: 2 jobs: build: docker: # specify the version you desire here - image: circleci/ruby:2.5.1-node-browsers environment: # environment variables for primary container RAILS_ENV: test - image: redis:5.0.3-alpine - image: mdillon/postgis:11 working_directory: ~/repo steps: - checkout - setup_remote_docker: docker_layer_caching: true - run: docker build -t myapp . # Database setup - run: docker run myapp bin/rake db:setup - run: name: run tests command: docker run myapp rspec
What I’m doing is, build my image and then run DB setup and my tests. The issue I’m having is that the command
docker run myapp bin/rake db:setup doesn’t have access to the Postgresql network so that fails with:
psql: could not connect to server: Connection refused Is the server running on host "0.0.0.0" and accepting TCP/IP connections on port 5432?
From what I understand, the
setup_remote_docker causes my Docker to run in a segregated environment and because of that I can’t get it to access my other dependencies.
Thoughts about how to access them from my running Docker container?