How to Deploy from Container Images

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


Prerequisites

Follow the Quickstart instructions for creating a DigitalOcean Container Registry, and push your image to the registry.

Deploy Resource using a Container Image as the Source

  1. Visit the Apps page.

  2. Click Create App if starting from scratch, or click an existing app to add your container image to your solution.

    • If adding an image to an existing solution, click the Create button and choose Create Resources From Source Code. You can add a Web Service, Worker, Job, or Functions.
  3. Select DigitalOcean Container Registry as the source for your code, choose the image you would like to use from the Repository drop-down, and select the tag of the image you would like to deploy.

  1. Configure resources for your app.

    • On the Resources page, click Edit Plan to select a plan and instance size you would like to use when a container is created from the image.
    • Click the edit icon corresponding to the resource to configure details such as HTTP routes, the run command, or the HTTP port. App Platform displays build and run commands that it detected, which you can customize as needed. Refer to the cloud-native buildpacks for instructions for specific buildpacks. For Dockerfile-based builds, entering a run command overrides the Dockerfile’s entrypoint.
    • Add new resources by expanding the Add Resource (Optional) section and selecting the Detect from Source Code option. Then, click Add. If your app needs a database, select the Database option to add a dev database or an existing managed database from your DigitalOcean account. The connection details for your database will be accessible via environment variables so that they can be conveniently accessed in your code.

    Click Next.

  2. If you want to use resource- and app-level environment variables, on the Environment page, click Edit to supply them. Click the Encrypt checkbox to ensure a variable’s value is encrypted in the App Spec. Click Next.

  3. If you want to change the default name or project for your app, or choose the region where you would like your app to be hosted, click Edit on the Info page. Click Save and then click Next.

    • The option to select a region is not available for static sites. Static components are served on DigitalOcean’s global CDN.
  4. Review your app’s resources, environment variables and billing information on the Review page and then click Create Resources.

Once your app deploys, you can view the app at the URL at the top of the app’s Overview page.

When updating the source image tag, a new deployment will be triggered. If the actual tag name has not changed, it is not guaranteed to pull down a fresh copy of the image due to caching. The recommended approach is to use unique tag names for all image updates.

Change the Tag of the Container Source After Deployment

You can change the tag of the container image to use as the source of an existing deployment:

  1. Visit the Apps page, click your app, and navigate to the Settings tab.
  2. Click the icon for the resource that you created using a container from your registry.
  3. Under the Source heading, click the Edit link. Use the Tag drop-down to select the desired tag and re-deploy your app.