Docker image

The Docker image task type is the most powerful type, as you can build and run any custom image on Airplane. This is useful if you're already building an image, or if you have a custom build process for your Docker images, and you want to use that image for your Airplane task.
If you'd like a custom Docker image but want Airplane to manage the build step, we recommend using Shell tasks, which allows specifying your own Dockerfile.

Getting started

Visit the New Task page to get started.

Define your task

In this first step, you'll be asked to give your task a name and (optional) description.

Parameters

Here, you can define parameters for your task—these parameters will later be passed to your code. (See the Parameters documentation for a full reference on what parameters are available.)

Build your task

Specify the image to use and the command to run:
If necessary, you can also set an entrypoint. If left unset, Airplane will use the default entrypoint of the image (if any).

Parameters

Parameters can be interpolated into your command using {{params.slug}}.
If you have control over the command arguments being run, Airplane recommends using {{JSON.stringify(params)}} to easily serialize parameters and pass them into your image.
javascript
Copied
1
// my_command receives a JSON string:
2
{"name": "John", "dry_run": false}

Private images on Airplane-hosted agents

If you're using Airplane-hosted agents (the default), you can access private images by attaching an environment variable named DOCKER_PULL_SECRETS. This variable should be a string in the Docker credentials format: a base64-encoded JSON string with username and password fields.
bash
Copied
1
$ echo '{"username": "MY_USERNAME", "password": "SECRET_PASSWORD"}' | base64
2
eyJ1c2VybmFtZSI6ICJNWV9VU0VSTkFNRSIsICJwYXNzd29yZCI6ICJTRUNSRVRfUEFTU1dPUkQifQo=
Airplane-hosted agents do not yet support other forms of registry authentication. For GCP and AWS integration, see self-hosted agents below.

Private images on self-hosted agents

Self-hosted agents run in a customer's environment and can utilize native features of GCP and AWS to access private registries hosted on Google GCR and Amazon ECR, respectively.
On GCP, ensure that the instance running the agent has the necessary GCP permissions to access the GCR repository. The agent will automatically use the instance's IAM permissions to acquire Docker credentials when pulling from *.gcr.io registries.
On AWS, ensure that the instance running the agent has the necessary IAM permissions to pull from Amazon ECR. The agent will automatically use the instance's IAM permissions to acquire Docker credentials when pulling from *.amazonaws.com registries.