The docker package provides tasks for interacting with docker.
A build task will build a docker image.
| Name | Required | Default | Description |
| ---------- | -------- | ------- | ----------- |
| dockerfile | Yes | | The dockerfile to use while building |
| files | | | A list of files that should be made available for the build |
| labels | | | A list of labels to set on the image being built |
| tag | | | The tag to apply to the image |
| tags | | | The list of tags as described above |
| target | | | The name of the target to build in a multi stage dockerfile |
At least one tag must be supplied by either the
`tag` or
`tags` attribute. If both are
supplied,
`tag` is inserted to the front of
`tags`.
## docker/environment Task An environment task will read a file with environment variables and make them accessible to your plans.
A file is expected to have lines of the form
`variable=value`. Empty lines are ignored. Files are read
from the workspace, so files generated by the plan do not need to be exported in order to be a target
of an environment task. From the other direction, it is necessary to import files on the host if they are
to be read by an environment task.
| Name | Required | Default | Description |
| ---------- | -------- | ------- | ----------- |
| from-file | | | A file that should be read. |
| from-files | | | A list of files that should be read. |
| prefix | | | A prefix to add to each variable read from a file |
At least one file must be supplied by either the
`from-file` or
`from-files` attributes. If both are supplied,
`from-file` is inserted to the front of
`from-files`. If the files being read are a result of environment variable
expansion, the order that the files are read are not guaranteed to be stable (or in the order supplied). Be cautious
of this if the environment files define overlapping variables.
An export task copies files from the volume to the host.
| Name | Required | Default | Description |
| ----- | -------- | ------- | ----------- |
| files | Yes | | A single filename or a list of files to copy from the workspace to the host. Files can be specified in one of two forms which can be mixed. The first is
`source:destination` and the other is
`filename` where filename will be used for both the host and the volume. |
- binary:binary-linux-x86_64
An import task copies files from the host to the volume. It has one required attribute named sources. This is a list of files relative to the directory that convey was run from that will be copied into the volume.
| Name | Required | Default | Description |
| ----- | -------- | ------- | ----------- |
| files | Yes | | A single filename or a list of files to copy from the host to the workspace. Files can be specified in one of two forms which can be mixed. The first is
`source:destination` and the other is
`filename` where filename will be used for both the host and the volume. |
A login task will run docker login to login to a registry.
| Name | Required | Default | Description |
| -------- | -------- | ------- | ----------- |
| username | Yes | | The username to login with. |
| password | Yes | | The password to login with. |
| server | | | The server to login to. If omitted docker hub is used. |
A logout task will log you out from a Docker registry.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| server | | | The server to logout from. If omitted docker hub is used. |
server: registry.my.domain:5000
A pull task pulls an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to pull. |
| images | | | A list of images as described above. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
image: gliderlabs/alpine:edge
A push task pushes an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to push. |
| images | | | A list of images as described above. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
- registry.my.domain:5000/newimage:master-latest
- registry.my.domain:5000/newimage:master-deadbeef
A remove task removes an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to remove. |
| images | | | A list of images as described above. |
| quiet | | false | True if a missing image should not count as a task failure. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
- registry.my.domain:5000/newimage:master-latest
- registry.my.domain:5000/newimage:master-deadbeef
A run task runs an image.
| Name | Required | Default | Description |
| ----------- | -------- | ---------- | ----------- |
| command | | | The command to run in the container. This is only necessary if the image does not provide a command by default. |
| detach | | false | Will run the container in the background allowing other tasks to run. The container will be cleaned up on exit. If the image has a HEALTHCHECK specified in the Dockerfile, convey will wait until it is healthy before proceeding. |
| hostname | | | Will set the --network-alias argument in the docker run command. This is generally only useful to connect to service containers. |
| user | | | The user to run as when executing the script or command inside the container. |
| entrypoint | | | The entrypoint to use for the container. This is only necessary if the image does not provide one by default. |
| environment | | | A list of environment variables to set. The should be specified in a
`NAME` or
`NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. |
| healthcheck | | | See the HealthCheck attributes below. |
| image | Yes | | The image including the registry and tag to run. |
| labels | | | A list of labels to set on the image being built |
| workdir | | | The working directory to use in the container. |
| workspace | | /workspace | The path inside the container to mount the workspace volume. |
### HealthCheck Attributes All of these attributes map directory to the
`--health` arguments to
`docker run`.
| -------- | ----------- |
| command | The command to run as the health check. |
| interval | The interval with which to check the health. |
| retries | The number of attempts before giving up. |
| start-period | How long to wait before starting to check the container's health. |
| timeout | How long to wait for a health check to return before aborting. |
A basic example where the image knows everything to do.
A basic example using a standard image to do something else
image: debian:jessie-slim
- wget https://somedomain.tld/file1
- wget https://somedomain.tld/file1.sha256
- sha256sum -c file1.sha256
A more compilicated example waiting for a detached nginx to start
command: wget http://localhost
A tag task will tag an existing image.
| Name | Required | Default | Description |
| ----------- | -------- | ---------- | ----------- |
| source | | | The source image, including registry and tag, to tag. |
| destination | | | The destination tag, including registry and tag, to tag. |
source: registry.my.domain:5000/newimage:latest
destination: registry.my.domain:5000/newimage:development