Defer build until service containers are running like docker compose

Issue #14120 wontfix
Christian Rolf
created an issue

We want to compose multiple services using Docker, configured via environment variables and talk to each via links.

Here is an (anonymized) example of our docker-compose file:

# Run using scripts in ../bin/ to set env vars correctly

version: '2'
services:
  service-a:
    container_name: ${SERVICE_ID}
    image: ${DOCKER_IMAGE}
    ports:
      - ${PORT}:${PORT}
    environment:
      - DYNAMO_AWS_REGION=ap-southeast-2
      - DYNAMO_ENDPOINT=http://dynamo:8006
      - DYNAMO_TABLE_NAME=table
      - SQS_LOCAL_PORT=9324
      - SPRING_PROFILES_ACTIVE=local,docker

    depends_on:
      - service-b
      - db2
      - elasticmq-sqs
    links:
      - db2:dynamo
      - elasticmq-sqs:sqs

  db2:
    container_name: ${SERVICE_ID}-dynamo
    image: tray/dynamodb-local
    ports:
      - 8006:8006
    command: -inMemory -port 8006 -sharedDb

  service-b:
    container_name: service-b
    image: someImage:1.0.0-SNAPSHOT
    environment:
      - DYNAMO_AWS_REGION=ap-southeast-2
      - DYNAMO_AWS_ENDPOINT=http://dynamodb:8005
      - DYNAMO_TABLE_NAME=table
    ports:
      - 8085:8085
    depends_on:
      - db1
    links:
      - db1:dynamodb

  db1:
    container_name: db1
    image: tray/dynamodb-local
    ports:
      - 8005:8005
    command: -inMemory -port 8005 -sharedDb

  elasticmq-sqs:
    image: tddmonkey/elasticmq
    ports:
      - 9324:9324

Comments (6)

  1. Matt Ryall staff

    Given the low interest in this issue, we don't have plans to implement it in the near future. There are good workarounds where you can ping a port until it becomes available, like dockerize -wait.

    I'll close this as "won't fix" to reflect the current status of this ticket.

  2. Log in to comment