Docker Community Forums

Share and learn in the Docker community.

Does anyone have a working example of docker-compose within docker-dind?

Hello all!

I have been trying for a while to use docker-compose with DinD and I do not manage to have it working. Does anyone have a working example?

I have the following but it fails because compose says " Path to a certificate and key files must be provided through the client_config param" which might be related to TLS.

  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: '/certs'  
    - docker
  stage: test
  image: docker:19.03.12
    - name: docker:19.03.12-dind
      alias: localhost

    - apk update && apk add --no-cache curl
    - curl -L --fail -o /usr/local/bin/docker-compose
    - chmod +x /usr/local/bin/docker-compose
    - echo "$CI_JOB_TOKEN" | docker login -u $CI_REGISTRY_USER --password-stdin $GITLAB_REGISTRY
    - cd Application/server
    - docker pull $SERVER_TESTING_IMAGE_NAME:latest || true
    - docker-compose -f ./config/docker-compose-testing.yml build --no-cache

Thank you in advance and kind regards

It is docker-compose the one failing, for example I got this error when calling compose build:

compose.config.config.find: Using configuration files: ././config/docker-compose-testing.yml
compose.cli.main.main: TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly.

My workaround for now is to not use docker-compose and call manually all the containers with docker run as it works in this way.