Reputation: 145
I’d like to do
docker-compose up -d
Seems like plugins/docker
is able to do what I want, but it fails if I don’t specify the publish-related stuff. I want to use it without publishing.
Another alternative could be services, but I try always failed
the code from docs.drone.io/docker_dind
kind: pipeline
name: default
steps:
- name: test
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 5 # give docker enough time to start
- docker ps -a
- docker-compose -v # new
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
Error:
/usr/drone/bin/init: line 23: docker-compose: not found
Upvotes: 10
Views: 8716
Reputation: 3471
you can use this yml for drone run docker compose :
- name: publish
image: docker/compose:1.25.0-rc2-alpine
commands:
- docker-compose -f <docker compose filename>.yml up -d
volumes:
- name: dockersock
path: /var/run/docker.sock
depends_on:
- build
Upvotes: 0
Reputation: 1889
The docker:dind
container does not seem to have "docker-compose" installed. You can try using the docker/compose:1.23.2
container. You need to mount the docker socket file if you intend on using your host docker resources (ie. images, networks). Otherwise, you need to mount your directory with the docker-compose file to the /code
directory.
docker/compose image reference: https://hub.docker.com/r/docker/compose/
See code below for reference:
kind: pipeline
name: default
steps:
- name: test
image: compose:1.23.2
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- up -f /drone/src/docker-compose.yaml
volumes:
- name: docker_sock
host:
path: /var/run/docker.sock
Upvotes: 11