Deploy an image
If you already build your image in CI, you can skip the build and run it as it is. CTRL pulls the image, turns it into the VM's disk, and runs its ENTRYPOINT and CMD.
From the dashboard#
- Open deploy.
- Click deploy a docker image instead under the repo list.
- Fill in the form:
- app name: the name shown in the dashboard.
- repository and branch: these only name the app. Its id is made from your GitHub login, the repository and the branch, for example
octocat-my-api-main. Nothing is cloned. - docker image: the full image reference, for example
ghcr.io/acme/my-api:latest. - region.
- Click deploy.
The dashboard deploys an image on port 8080, with 1 vCPU, 2048 MB of memory and 30720 MB of disk. Your image must listen on port 8080. To pick another port or size, use the CLI or the API.
The image form has no env vars. Add them on the app page after the first deploy. Saving them redeploys the app.
From the CLI#
ctrl deploy --image ghcr.io/acme/my-api:latest --name my-api --region us-east --port 3000
--image, --name, --region and --port are required. The rest are optional:
| Flag | Default | What it sets |
|---|---|---|
--repo |
the --name value |
Part of the app id |
--branch |
main |
Part of the app id |
--vcpu |
1 |
Whole vCPUs |
--mem |
2048 |
Memory in MB |
--disk |
30720 |
Disk in MB |
If the deploy outlasts the API's time limit, the CLI waits for it, up to an hour, and then prints the app's URL.
From the API#
Send image_ref to POST /v1/apps, and leave out repo_url. You must send exactly one of the two, or the API answers provide exactly one of image_ref or repo_url.
curl -X POST https://api.getctrl.dev/v1/apps \
-H "Authorization: Bearer $CTRL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "my-api",
"repo": "my-api",
"branch": "main",
"image_ref": "ghcr.io/acme/my-api:latest",
"region": "us-east",
"exposed_port": 3000,
"cpu_millis": 500,
"mem_size_mb": 1024,
"disk_size_mb": 10240,
"env_vars": [["PORT", "3000"]]
}'
repo and branch only name the app, as in the dashboard. Sizes: cpu_millis is at least 100, in steps of 50, mem_size_mb at least 256, and disk_size_mb at least 5120. You can send vcpu_count for whole vCPUs instead of cpu_millis.
Registries and image references#
CTRL pulls with skopeo, from any registry the node can reach: Docker Hub, GitHub Container Registry, and others. Write the full reference, with the registry host:
docker.io/library/nginx:1-bookworm
ghcr.io/acme/my-api:latest
ghcr.io/acme/my-api@sha256:<digest>
A tag is looked up each time the app deploys. A reference pinned by digest always gets that exact image.
The image must be public. Private registries are coming soon.
If the pull fails, the build output shows skopeo inspect failed for <ref> or skopeo copy failed for <ref>. Check the spelling of the reference, that the tag exists, and that the image is public.
The port#
exposed_port is the port your app listens on inside the VM. CTRL sends your app's traffic there.
- CTRL doesn't set
PORTfor an image. If your app readsPORT, add it as an env var with the same value. - Listen on
0.0.0.0, not127.0.0.1. - The image's
EXPOSEline isn't used. Onlyexposed_portcounts.
How the image runs#
ENTRYPOINTandCMDrun without a shell, so$VARIABLESin an exec-form command are not expanded. Usesh -cif you need them.- The image's
USERis ignored. Your app runs as root inside its own VM. /runand/tmpare empty at every boot.
Ship a new version#
Push a new image, then redeploy the app:
ctrl deploy my-api
Or call POST /v1/apps/:app_id/redeploy, for example from CI. Both pull the image reference again with the app's current env vars. If you use a moving tag such as latest, this gets what the tag points to now.
An image app has no push-to-deploy and no rollback. The API refuses a rollback with cannot rollback an image app -- deploy history records no image; redeploy the image tag you want. To go back, point the app's tag at the old image in your registry, then redeploy. See Lifecycle.
To have CTRL build from your repo instead, see Deploy from GitHub.