If you’re looking to deploy your own container on DigitalOcean’s App Platform, there are a few things you’ll need to do. First, create a new account and select the “Container” type. Next, choose the “Deployment Type” and enter in a name for your container. Finally, choose the “Location” and enter in the address of your DigitalOcean account. Once you’ve created your container and set up its deployment, you can start using it!


App Platform is a new DigitalOcean service which offers fully managed app deployment from source control or a container image. Here’s how you can get a container live in the cloud using an image in your DigitalOcean Container Registry.

Setup Your Container Registry

You’ll first need to create your container registry. Login to your DigitalOcean control panel and click the “Container Registry” link from the left sidebar.

Give your new registry a name. Names need to be between 3 and 63 characters long, using only letters, numbers and dashes.

Three Container Registry subscription plans are available: Free, Basic and Professional. The Free tier gives you a single repository and 500MB of storage.

Select a tier and click the “Create Registry” button to provision your registry. This may take a few seconds.

“Docker Login” to Your Registry

You’ll be taken to your registry’s management page once provisioning is complete. Click the grey “Actions” button in the top-right. Select “Download Docker Credentials” from the menu.

Change the “Credential permissions” radio buttons to “Read & Write”. This will allow you to push new images into your registry. Click the blue “Download Config” button to acquire a new configuration file for use with Docker.

You’re now ready to interact with your registry using the Docker CLI on your system. Rename the downloaded configuration file to config.json and move it into a new directory. When using Docker, pass the –config flag with the path to this directory. The Docker client will load the config.json within, so Docker will be able to authenticate to your registry.

There are other ways of getting Docker connected to your registry, including via DigitalOcean’s Doctl command-line tool. We’re using the simplest approach here to stay focused on App Platform, rather than the nuances of Docker and Container Registry.

Create and Build Your Image

With your Container Registry setup, it’s time to push your Docker image! Once your image is in your registry, App Platform will be able to retrieve and deploy it.

For the sake of this tutorial, we’ll reuse the default Apache 2 image – httpd:latest on Docker Hub. Pull the image to your machine, then push it back to your DigitalOcean Container Registry.

Remember to specify the correct authentication configuration file when pushing to your DigitalOcean registry. You’ll also need to modify the paths shown to match your own Container Registry’s name. This is the value you chose on the creation screen. It’s displayed on the registry’s page in the Control Panel.

You should see your image show up in the Container Registry web interface once the push completes. You’re now ready to deploy it using App Platform.

Deploying With App Platform

Switch to App Platform by clicking the “Apps” link at the top of the “Manage” section of the left sidebar. Click the blue “Launch Your App” button to continue.

Choose “DigitalOcean Container Registry” as the repository source.

On the next screen, select your image from the “Repository” dropdown. You can change the tag to deploy using the “Tag” dropdown. Click the “Next” button to continue. You can now configure your container and how it’s exposed.

“HTTP Routes” let you change the URL base (e.g. to my-domain.com/my-example-base). Set up key-value environment variable pairs using the “Environment Variables” section. The “Run Command” option allows you override the command that will be run in the container. For our simple Apache container, all of these should be left as defaults.

The “HTTP Port” section defines the port your container listens on. Apache uses port 80 by default so this value must be updated. Click the “Edit” link and change the port to 80.

Click the “Next” button to continue. Give your app a name and select the DigitalOcean datacentre region to serve it from. At the time of writing, only a subset of the DigitalOcean datacentres support App Platform. Try to choose the one closest to you and to your users.

Finally, select the App Platform plan to subscribe to. Container Images aren’t supported on the free Starter plan. Select the “Basic” or “Pro” tier and then choose the hardware size to deploy. For our simple Apache image, the Basic tier with a single $5/mo 512MB container instance is adequate.

Click “Launch Basic App” to begin your deployment. You’ll be taken to your app’s dashboard where you can monitor the provisioning process. This may take a few minutes to complete. Once the deployment’s finished, you’ll see your app’s live URL. Click the link to view your deployed container!

Updating Your Deployment

Your deployment will be updated automatically when the source image tag changes. Push a new image version to your Container Registry to trigger a rebuild of your app. A few minutes later, the new deploymment will show up.

DigitalOcean cautions that image caching might mean new deployments don’t always occur if you have’t changed the actual tag name. It advises using unique tag names for each image update to help mitigate this risk.

Managing Your App

You can manage your app from its App Platform page. You can see metrics on resource usage (“Insights”), a log of recent deployments (“Deployments”) and realtime logs from within the container (“Logs”). The “Console” tab gives you a shell session within your container.

You can make changes to your deployment configuration using the “Settings” tab. Here you’ll find options for adding a domain name and reconfiguring environment variables.

More settings are found on the “Components” tab. This lets you modify the container configuration, including the container registry source (image and tag) and HTTP routes and port.

Environment variables set on this screen are specific to the container component; those defined on the “Settings” screen apply to all components in your app. A single App Platform app can have multiple components, such as a container and a database connection.

To delete your app, use the red “Destroy” button at the bottom of the Settings screen. Individual components can be removed from the “Components” tab. To delete your container image, return to the Container Registry interface, click the three dots to the right of your image name and click “Delete”.

Summary

DigitalOcean’s App Platform and Container Registry provide a straightforward way to get containerised workloads deployed in the cloud. You don’t need to install Docker or setup any reverse proxies to manually route traffic.

These qualities mean App Platform is ideal when you’re deploying a simple workload. Containerised static sites are particularly well suited to this style of deployment. App Platform also supports stateful containers with persistent storage and Managed Database connections, so you could also use it to run your backend containers.