Docker-compose not available with docker:dind?

Dear GitLab support!

My dockerized Scala application uses GitLab CI for testing and deploying.
Deploying works fine, but for testing I require docker-compose to be available since the tests run against the application’s containers.

In the .gitlab-ci.yml I use Docker In Docker with

services:
  - docker:dind

The base image provides Docker and SBT for building the app.

If I have understood the docs correctly, dind includes Docker Compose.

Yet when I execute my tests with dockerComposeTest, an SBT task provided by this nice plugin that uses Docker Compose to start up the app’s containers and runs tests against them, I get the following error:

java.io.IOException: Cannot run program “docker-compose”: error=2, No such file or directory

How can I make docker-compose available in that job so the SBT task can use it?

Thanks a lot in advance!

1 Like

Bump, because have the exact same question.

docker-compose is not included in docker:latest image.
You can create your own image based on docker:latest with a Dockerfile like this one, which is inspired by the official dockerfile from https://github.com/docker/compose/blob/master/Dockerfile.run

FROM docker:latest
ENV GLIBC 2.23-r3
RUN apk update && apk add --no-cache openssl ca-certificates && \
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC/glibc-$GLIBC.apk && \
    apk add --no-cache glibc-$GLIBC.apk && rm glibc-$GLIBC.apk && \
    ln -s /lib/libz.so.1 /usr/glibc-compat/lib/ && \
    ln -s /lib/libc.musl-x86_64.so.1 /usr/glibc-compat/lib && \
    wget https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose && \
    chmod +x /usr/local/bin/docker-compose

Thanks perrinl, I will try that.