1.8 KiB
Services
Drone uses the compose
section of the .drone.yml
to specify supporting containers (ie service containers) that should be started and linked to your build container. The compose
section of the .drone.yml
is modeled after docker-compose
:
compose:
[container_name:]
image: [image_name]
[options]
Example configuration that composes a Postgres and Redis container:
compose:
cache:
image: redis
database:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=mysecretpassword
Service linking
Service containers share the same network as the build container (using --net=<container>
). This means that you can access your service container using localhost
or 127.0.0.1
.
Service options
The service container configuration options:
image
- any valid Docker image namepull
- if true, will always attempt to pull the latest imageenvironment
- list of environment variables, declared inname=value
formatprivileged
- if true, runs the container with extended privileges [1]volumes
- list of bind mounted volumes on the host machine [1]net
- sets the container network mode [1]
[1] Some build options are disabled for security reasons, including volumes
, privileged
and net
. To enable these options, a system administrator must white-list your repository as trusted. This can be done via the repository settings screen.
Service images
The image
attribute supports any valid Docker image name:
# Docker library image
image: postgres
# Docker library image, with tag
image: postgres:9.2
# Docker image, full name, with tag
image: library/postgres:9.2
# fully qualified Docker image URI, with tag
image: index.docker.io/library/postgres:9.2