Skip to content

Deploy a Docker image

Run a public image by tag or digest, set its port and command, with no build step.

Updated

An image service runs a container image that is already built. Cloud pulls the image and runs it: there is no repository and no build step. Use it for software that ships as an image, or for your own application when you build images in your own pipeline and push them to a public registry.

Create the service

On a project, press Add a service, then Create on the Docker image card. The form, "From a Docker image", reads "Cloud pulls the image and runs it. Nothing is built." and asks for:

FieldWhat it takes
ImageThe repository on any public registry, with its host when it is not Docker Hub, such as nginx or ghcr.io/acme/web.
Taglatest unless you change it. Ignored when a digest is given.
DigestOptional. It pins one exact build, such as sha256:…, and replaces the tag.
NameUp to 40 characters.
SizeThe size the container runs at. Sizes and replicas explains them.

Under the tag and digest, the line "Cloud will run" shows the whole reference Cloud will pull. The reference is at most 255 characters with no spaces; anything else is refused with "Name the image to run, such as nginx:alpine."

Press Create service. Cloud opens the new service's page and deploys nothing yet. The image reference is fixed once the service exists: to run a different image, create another service.

Public images only

Cloud cannot pull from a private registry yet. The way the platform logs in to a registry would leave one customer's registry credentials usable by another customer's pulls, so private registries wait until credentials can be held to a single application. To run private code today, build it from a private GitHub repository instead: Deploy from GitHub explains how the per-deploy token works.

Before the first deploy

Two settings decide whether the container can be reached once it runs. Set both before you press Deploy.

Port

The form has no port field. Cloud sends traffic to port 3000 inside the container until you change Port on the service's Settings section and press Save settings. Set it to the port your image listens on.

Do this before the first deploy. An application with no domain is given an address on the platform's domain at its first successful deploy, and a domain keeps the port the service had when the domain was made. Domains explains what to do if you change Port later.

Start command

The Command card on the Overview section replaces the image's own command. Leave Start command empty to run the image's command.

Set one when the image's own command is not what should run, for example an image whose default opens an interactive shell or a setup wizard. With nothing typed at it, such a container exits at once and is started again for as long as the service runs, and the Overview shows "The engine keeps restarting this service".

The start command is split on spaces and run directly, with no shell. A quote, a pipe, a redirection or && reaches the program as a literal word, and wrapping the command in sh -c "..." does not help, because the quotes are split into words too. When a container needs more than one step at boot, put a script in the image or on a volume and make the start command run it. A start command is one line of at most 500 characters.

Press Save command. On a running service the new command takes effect at once: the service restarts with it.

Deploy

Press Deploy in the service's header. Cloud opens the new deployment, whose Build log shows the image being pulled. An image service has no deploy on push: every deployment is one you ask for. Each deployment pulls the reference again, so a tag such as latest runs whatever it points at by then, and a digest always runs the same build.

Deployments covers statuses and cancelling.

Scale it

The Settings section also sets Size and Replicas, from 1 to 10 copies running side by side. A running service takes a new size, replica count or port at once, and restarts to do so. Sizes and replicas explains the sizes and how each is charged.