User docker-compose instead of itemizing images to run needed services for build

docker

#1

I’d like to use a docker-compose.yml file as the canonical list of services my app needs in order to run locally and run tests, for example:

version: '2'
services:
  rabbit:
    image: rabbitmq:3.6.10-management
    ports:
      - "10001:5672"
      - "10002:15672"
  resque:
    image: redis:2.8.12
    ports:
      - "10003:6379"

Locally, our test spins up docker-compose so this stuff is available. This didn’t work on Circle’s machine image, because it contains an older version of docker-compse that doesn’t support version 2, so I tried the newer (and, if I read the tea leaves, correct and future-proof) Docker setup:

This results in duplicated configuration in .circleci/config.yml:

version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.4
      - image: rabbitmq:3.6.10-management
      - image: redis:2.8.12
    steps:
      - checkout
# etc.

The documentation around Docker and docker-compose is fairly confusing and unclear, but it seems aimed toward building Docker images to publish as part of a build step. I want to use Docker to run needed backing services and I want a single way to do it that works in dev and in Circle.

Is there a way to do what I’m trying to do without having to download and run a bunch of stuff manually? If you squint at the Circle-specific docker: stanza, it could be a docker-compose.yml, so is there a way to make this work?


#2

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