I’ve got two Docker containers which I want to start/link but I get connection refused for Postgres and Connection refused for trying to ping web server container on localhost.
Both images start/link fine and work as expected outside of CircleCI so my issue must be related to how they are to be set up within CircleCI.
version: 2
jobs:
build:
docker:
- image: circleci/node:latest-browsers
parallelism: 1
working_directory: ~/myFolder
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Start application API
command: |
set -e
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker pull delaneymethod/postgres:9.5
docker pull delaneymethod/nginx-phpfpm:latest
docker run --rm --name ci-postgres -d -p 5432:5432 -e POSTGRES_USER=e2e -e POSTGRES_DB=e2e -e POSTGRES_PASSWORD=e2e -e PGDATA=/var/lib/postgresql/data/pgdata delaneymethod/postgres:9.5
docker run --rm --name ci-webserver -d -p 8000:80 --link postgres:postgres delaneymethod/nginx-phpfpm:latest
docker ps -a
curl --retry 3 http://localhost:8000
Within my Nginx-PHP container, the DB host is set to DB_HOST=postgres
Any ideas what I’m doing wrong/missing?