Skip to content

Latest commit

 

History

History
205 lines (159 loc) · 5.04 KB

tasks.md

File metadata and controls

205 lines (159 loc) · 5.04 KB

Task Reference

Run Task

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

Property Description Required
image Docker image to use Yes
build Options for building a docker image No
update Pull or build image before executing task No
pull Pull image before executing task No
auto_remove Remove container after task is finished No
environment Add environment variables No
volumes Volumes to mount into the container No
entrypoint Override the default entrypoint No
command Override the default image command No
user User to run the command as No
working_dir Working directory for the command No

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

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

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

Property Description Required
container Container name or container id Yes
command Command to execute inside the container Yes
environment Add environment variables No
working_dir Working directory for the command No
user User to execute as No

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

Property Description Required
container Container name or container id Yes
signal Signal to send to the process Yes

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