Drone

How can I run docker compose file in a kubernetes pipline step?

Below is the yaml I am using

kind: pipeline
type: kubernetes
name: default

steps:
  - name: build-project
    user: root
    image: gradle:jdk11
    commands:
    - ./gradlew clean build

  - name: docker-compose
    image: docker/compose
    volumes:
      - name: docker_socket
        path: /var/run/docker.sock
    commands:
      - docker-compose -f docker-compose.yaml up -d

volumes:
  - name: docker_socket
    host:
      path: /var/run/docker.sock

The build gets stuck…

this works for me :slight_smile:

kind: pipeline
type: kubernetes
name: default

steps:
  - name: build-project
    user: root
    image: gradle:jdk11
    commands:
    - ./gradlew clean build

  - name: docker-compose
    image: docker/compose
    commands:
      - export DOCKER_HOST=127.0.0.1:2375
      - export DOCKER_DRIVER=overlay2
      - docker-compose build --pull

services:
  - name: docker-run
    image: docker:18.09-dind
    privileged: true

let me know if there are other ways to do it.