Skip to main content

Docker Tasks


Docker tasks are handled by the awesome shiplift crate. To use docker tasks, you'll need to have the docker daemon up and running, and if you use Linux, be sure that the user who runs StewardX can run docker commands without sudo. You can find how to add your user to docker group here. A docker task has two subtypes.


Docker image#

It is the docker image (like the ones you pull from Dockerhub). You provide the name:tag and StewardX pulls it then runs it.


To use this type, you provide the contents of the dockerfile. StewardX will try to build it first, then will run it.


Whether the subtype is, StewardX will try to pull/build the image and run the container of it. You can provide the environment variables for both subtypes.


To abort a docker task, StewardX will first stops the container, then it kills it ๐Ÿ˜ˆ.


Property nameProperty TypeDefinition
imageImage Object see belowThe subtype of task and properties specific to the subtype
envArray of StringEnvironment variables of container, item format is "VARNAME=VALUE"
Image typeTypeDefinition
imageStringIt is image-name:tag
envStringIt is contents of the dockerfile.

Creating by API#

The task creation route is /tasks. Sending a POST request with required parameters will do.


Property nameProperty TypeDefinition
imageObjectImage object, see below
envArray of StringIt is the environment array, not required.

The image property is where you state the subtype of the task. Here's the structure of it:

"t": "It is the type property, either File or Image",
"c": "It is the content property, so either 'image:tag' or dockerfile contents"

Other parameters are the same as every task:

  • task_name: Name of the task (not type)
  • frequency: Frequency of task, currently Hook and Every(*cron string*)
  • task_type: Task type - in this case it's DockerTask

cURL example:

$ curl --header "Content-Type: application/json" -X POST --data '{"task_name": "Hello docker", "frequency": "Hook", "task_type": "DockerTask", "task_props": {"image": { "t": "Image", "c": "hello-world:latest"}}}' http://localhost:3000/tasks