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
The key difference between docker run versus docker-compose is that docker run is entirely command line based, while docker-compose reads configuration data from a YAML file. The second major difference is that docker run can only start one container at a time, while docker-compose will configure and run multiple.
Docker Compose is used to run multiple containers as a single service. For example, suppose you had an application which required NGNIX and MySQL, you could create one file which would start both the containers as a service without the need to start each one separately.
If you installed Docker Desktop/Toolbox for either Windows or Mac, you already have Docker Compose!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With