Task Reference

June 2, 2025 ยท View on GitHub

Run Task

runs a command inside of a new container, using a specific image.

PropertyDescriptionRequired
imageDocker image to useYes
buildOptions for building a docker imageNo
updatePull or build image before executing taskNo
pullPull image before executing taskNo
authAuthentication information for pulling imagesNo
auto_removeRemove container after task is finishedNo
environmentAdd environment variablesNo
networksNetworks to connect the container toNo
volumesVolumes to mount into the containerNo
entrypointOverride the default entrypointNo
commandOverride the default image commandNo
userUser to run the command asNo
working_dirWorking directory for the commandNo

image

Specify the image to start the container from. If you specify build, ckron uses this value as the name for the built image

image: redis
image: ubuntu:18.04
image: tutum/influxdb
image: example-registry.com:4000/postgresql
image: a4bc65f

build

Configuration options for building a docker image for use in the run task

build: ./dir
build:
  context: ./dir
  dockerfile: Dockerfile-alternate
  args:
    buildno: 1

update

Pull or build image before executing task. Default value is missing

update: always # Always update before executing task
update: never # Don't update image automatically
update: missing # Pull or build image if not found locally

pull

Deprecated: use update instead Pull image before executing task. Default value is missing

pull: always # Always pull before executing task
pull: never # Don't pull image automatically
pull: missing # Pull image if not found locally

auth

Authentication information for pulling images. Default value is missing

auth:
  username: '<username>'
  password: '<password>'
  email: '<email>'
  serveraddress: '<serveraddress>'

auto_remove

Remove container after task is finished. Default value is true

auto_remove: false

environment

Add environment variables. You can use either an array or a dictionary. Any boolean values (true, false, yes, no) need to be enclosed in quotes to ensure they are not converted to True or False by the YML parser.

environment:
  RACK_ENV: development
  SHOW: 'true'
  SESSION_SECRET:

environment:
  - RACK_ENV=development
  - SHOW=true
  - SESSION_SECRET

networks

Connect the container to one or more networks. You must use an array.

networks:
  - net_1
  - net_2

volumes

Bind mount host machine directory into the container. It uses SOURCE:TARGET[:MODE] format, where SOURCE is a host path and TARGET is the container path where the directory is mounted. Standard modes are ro for read-only and rw for read-write (default).

volumes:
  - /opt/data:/var/lib/mysql
  - /etc/config:/etc/config:ro

entrypoint

Override the default entrypoint. The entrypoint can also be a list

entrypoint: /code/entrypoint.sh
entrypoint: ["php", "-d", "memory_limit=-1", "vendor/bin/phpunit"]

command

Override the default image command. The command can also be a list

command: touch /tmp/example
command: ["touch", "/tmp/example"]

user

User to run the command as.

user: nobody

working_dir

Working directory for the command.

working_dir: /tmp

Exec Task

Runs a new command in a running container

PropertyDescriptionRequired
containerContainer name or container idYes
commandCommand to execute inside the containerYes
environmentAdd environment variablesNo
working_dirWorking directory for the commandNo
userUser to execute asNo

container

Container name or container id of the container were the command should be executed.

container: my_container
container: c9b92d9a79d3

environment

Add environment variables. You can use either an array or a dictionary. Any boolean values (true, false, yes, no) need to be enclosed in quotes to ensure they are not converted to True or False by the YML parser.

environment:
  RACK_ENV: development
  SHOW: 'true'
  SESSION_SECRET:

environment:
  - RACK_ENV=development
  - SHOW=true
  - SESSION_SECRET

command

Command to execute inside the container. The command can also be a list

command: touch /tmp/example
command: ["touch", "/tmp/example"]

user

User to execute as.

user: nobody

Signal Task

Send a signal to the main process inside the container. Similar to docker kill --signal

PropertyDescriptionRequired
containerContainer name or container idYes
signalSignal to send to the processYes

container

Container name or container id of the container were the signal will be sent.

container: my_container
container: c9b92d9a79d3

signal

Signal to send to the process.

signal: SIGHUP

working_dir

Working directory for the command.

working_dir: /tmp