This plugin enables you to build and publish Docker images in a Vela pipeline.
Source Code: https://github.com/go-vela/vela-docker
Registry: https://hub.docker.com/r/target/vela-docker
NOTE:
Users should refrain from using latest as the tag for the Docker image.
It is recommended to use a semantically versioned tag instead.
Samples of building and publishing an image:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
registry: index.docker.io
tags: [ index.docker.io/octocat/hello-world:latest ]NOTE: The two above samples are functionally equivalent.
Sample of building an image without publishing:
steps:
- name: publish hello world
image: target/vela-docker:latest
pull: always
parameters:
+ dry_run: true
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]Sample of building and publishing an image with custom tags:
steps:
- name: publish hello world
image: target/vela-docker:latest
pull: always
parameters:
registry: index.docker.io
repo: octocat/hello-world
- tags: [ latest ]
+ tags:
+ - latest
+ - octocat/hello-world:1
+ - index.docker.io/octocat/hello-world:foobarSample of building and publishing an image with build arguments:
steps:
- name: publish hello world
image: target/vela-docker:latest
pull: always
parameters:
+ build_args:
+ - FOO=bar
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]Sample of building and publishing an image with image caching:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
+ cache_from: index.docker.io/octocat/hello-world
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]Sample of building and publishing with custom daemon settings:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
+ daemon:
+ registry_mirrors: mirror.index.docker.io
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]NOTE: Users should refrain from configuring sensitive information in your pipeline in plain text.
Users can use Vela internal secrets to substitute these sensitive values at runtime:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
+ secrets: [ docker_username, docker_password ]
parameters:
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]
- username: octocat
- password: superSecretPasswordThis example will add the secrets to the
publish_hello-worldstep as environment variables:
DOCKER_USERNAME=<value>DOCKER_PASSWORD=<value>
The plugin accepts the following files for authentication:
| Parameter | Volume Configuration |
|---|---|
password |
/vela/parameters/docker/password, /vela/secrets/docker/password |
username |
/vela/parameters/docker/username, /vela/secrets/docker/username |
Users can use Vela external secrets to substitute these sensitive values at runtime:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]
- username: octocat
- password: superSecretPasswordThis example will read the secret values in the volume stored at
/vela/secrets/
NOTE:
The plugin supports reading all parameters via environment variables or files.
Any values set from a file take precedence over values set from the environment.
By default build kit is on; it can be turned off by setting
DOCKER_BUILDKIT=0in the environment.The
key.keysyntax signifies a new yaml object within the definition.
The following parameters are used to configure the image:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
add_hosts |
set a custom host-to-IP mapping - format (host:ip) | false |
N/A | PARAMETER_ADD_HOSTSDOCKER_ADD_HOSTS |
build_args |
set variables to pass to the image at build-time | false |
N/A | PARAMETER_BUILD_ARGSDOCKER_BUILD_ARGS |
cache_from |
set of images to consider as cache sources | false |
N/A | PARAMETER_CACHE_FROMDOCKER_CACHE_FROM |
cgroup_parent |
set a parent cgroup for the container | false |
N/A | PARAMETER_CGROUP_PARENTDOCKER_CGROUP_PARENT |
compress |
enable compressing the build context using gzip | false |
false |
PARAMETER_COMPRESSDOCKER_COMPRESS |
context |
set of files and/or directory to build the image from | true |
. |
PARAMETER_CONTEXTDOCKER_CONTEXT |
cpu |
set the cpu parameter, see cpu settings below | false |
N/A | PARAMETER_CPUDOCKER_CPU |
daemon |
set the daemon parameter, see daemon settings below | false |
N/A | PARAMETER_DAEMONDOCKER_DAEMON |
disable_content_trust |
enable skipping verification of the image | false |
true |
PARAMETER_DISABLE_CONTENT_TRUSTDOCKER_DISABLE_CONTENT_TRUST |
dry_run |
enable building the image without publishing | false |
false |
PARAMETER_DRY_RUNDOCKER_DRY_RUN |
file |
set the name of the Dockerfile | false |
N/A | PARAMETER_FILEDOCKER_FILE |
force_rm |
enable always removing the intermediate containers after a successful build | false |
false |
PARAMETER_FORCE_RMDOCKER_FORCE_RM |
image_id_file |
set the file to write the image ID to | false |
N/A | PARAMETER_IMAGE_ID_FILEDOCKER_IMAGE_ID_FILE |
isolation |
set container isolation technology | false |
N/A | PARAMETER_ISOLATIONDOCKER_ISOLATION |
labels |
set metadata for an image | false |
N/A | PARAMETER_LABELSDOCKER_LABELS |
log_level |
set the log level for the plugin | true |
info |
PARAMETER_LOG_LEVELDOCKER_LOG_LEVEL |
memory |
set memory limit | false |
N/A | PARAMETER_MEMORYDOCKER_MEMORY |
memory_swaps |
set the swap limit equal to memory plus swap: '-1' to enable unlimited swap | false |
N/A | PARAMETER_MEMORY_SWAPSDOCKER_MEMORY_SWAPS |
network |
set the networking mode for the RUN instructions during build | false |
N/A | PARAMETER_NETWORKDOCKER_NETWORK |
no_cache |
disable caching when building the image | false |
false |
PARAMETER_NO_CACHEDOCKER_NO_CACHE |
output |
set the output destination - format (type=local,dest=path) | false |
N/A | PARAMETER_OUTPUTSDOCKER_OUTPUTS |
password |
set password for communication with the registry | true |
N/A | PARAMETER_PASSWORDDOCKER_PASSWORD |
platform |
set a platform if server is multi-platform capable | false |
N/A | PARAMETER_PLATFORMDOCKER_PLATFORM |
progress |
set type of progress output - options (auto|plain|tty) | false |
N/A | PARAMETER_PROGRESSDOCKER_PROGRESS |
pull |
enable always attempting to pull a newer version of the image | false |
false |
PARAMETER_PULLDOCKER_PULL |
quiet |
enable suppressing the build output and print image ID on success | false |
false |
PARAMETER_QUIETDOCKER_QUIET |
registry |
set Docker registry address to communicate with | true |
index.docker.io |
PARAMETER_REGISTRYDOCKER_REGISTRY |
remove |
enable removing the intermediate containers after a successful build | false |
true |
PARAMETER_REMOVEDOCKER_REMOVE |
repo |
set Docker repository for the image | false |
N/A | PARAMETER_REPODOCKER_REPO |
secret |
set secret file to expose to the build (only if BuildKit enabled) - format (id=mysecret,src=/local/secret) | false |
N/A | PARAMETER_SECRETSDOCKER_SECRETS |
security_opts |
set options for security | false |
N/A | PARAMETER_SECURITY_OPTSDOCKER_SECURITY_OPTS |
shm_sizes |
set the size of /dev/shm | false |
N/A | PARAMETER_SHM_SIZESDOCKER_SHM_SIZES |
squash |
enable squashing newly built layers into a single new layer | false |
false |
PARAMETER_SQUASHDOCKER_SQUASH |
ssh_components |
set SSH agent socket or keys to expose to the build (only if BuildKit enabled) - format (default|<id>[=<socket>|<key>[,<key>]]) |
false |
N/A | PARAMETER_SSH_COMPONENTSDOCKER_SSH_COMPONENTS |
stream |
enable stream attaching to the server to negotiate build context | false |
false |
PARAMETER_STREAMDOCKER_STREAM |
tags |
set the tags for the Docker image - format (name:tag) | true |
N/A | PARAMETER_TAGSDOCKER_TAGS |
target |
set the target build stage to build | false |
N/A | PARAMETER_TARGETDOCKER_TARGET |
ulimits |
set options for ulimits | false |
N/A | PARAMETER_ULIMITSDOCKER_ULIMITS |
username |
set user name for communication with the registry | true |
N/A | PARAMETER_USERNAMEDOCKER_USERNAME |
The following settings are used to configure the cpu parameter:
| Name | Description | Required | Default |
|---|---|---|---|
period |
set limit on the CPU CFS (Completely Fair Scheduler) period | false |
N/A |
quota |
set limit on the CPU CFS (Completely Fair Scheduler) quota | false |
N/A |
shares |
set CPU shares (relative weight) | false |
N/A |
set_cpus |
set CPUs in which to allow execution (0-3, 0,1) | false |
N/A |
set_mems |
set MEMs in which to allow execution (0-3, 0,1) | false |
N/A |
The following settings are used to configure the daemon parameter:
| Name | Description | Required | Default |
|---|---|---|---|
bip |
set a network bridge IP | false |
N/A |
dns |
set the DNS settings, see dns settings below | false |
N/A |
experimental |
enable experimental features | false |
N/A |
insecure_registries |
set the insecure Docker registries | false |
N/A |
ipv6 |
enable IPv6 networking | false |
N/A |
mtu |
set the network MTU for the contain | false |
N/A |
registry_mirrors |
set the Docker registry mirrors | false |
N/A |
storage |
set the storage settings, see storage settings below | false |
N/A |
The following settings are used to configure the dns daemon setting:
| Name | Description | Required | Default |
|---|---|---|---|
servers |
set the DNS nameservers | false |
N/A |
searches |
set the DNS search domains | false |
N/A |
The following settings are used to configure the storage daemon setting:
| Name | Description | Required | Default |
|---|---|---|---|
driver |
set the storage driver for the daemon | false |
N/A |
opts |
set the storage options for the daemon | false |
N/A |
COMING SOON!
You can start troubleshooting this plugin by tuning the level of logs being displayed:
steps:
- name: publish_hello-world
image: target/vela-docker:latest
pull: always
parameters:
registry: index.docker.io
repo: octocat/hello-world
tags: [ latest ]
+ log_level: trace
Below are a list of common problems and how to solve them: