Docker Hub Images

Deploying a Docker Image from Docker Hub

Flightcontrol supports deploying pre-built container images from two different image registries: Docker Hub (opens in a new tab) and AWS Elastic Container Registry (ECR) (opens in a new tab). This guide will walk you through deploying a Docker image from Docker Hub.

We will create an access token for Docker Hub so that you can give Flightcontrol read-only access to your Docker Hub account. Then we will configure a web application service that deploys an image from your Docker Hub image registry to AWS Elastic Container Service (ECS) Fargate. Last, we'll discuss how to automatically deploy changes to your application when you push a new image to Docker Hub.


You'll need the following before you begin:

Creating a Docker Hub Access Token

Flightcontrol needs to authenticate to your Docker Hub account to pull your Docker image. While you could use your username and password, we discourage that, and recommend creating a read-only access token for Flightcontrol instead.

You can use the access token in place of your password - your username will remain the same.

Let's go through the necessary steps.

Login to Docker Hub

Login to Docker Hub (opens in a new tab) and click on your profile picture in the top right corner. Then click on Account Settings.

Create a New Access Token

Click on Security in the left sidebar, then click on New Access Token.

Security Tab on Docker Hub Account Settings

Choose the Name and Permissions

Give your access token a name, and choose the Read-only access permissions. Then click on the Generate button.

New Access Token dialog

Save the Access Token

This will be the only time you see the access token, so copy and save the access token somewhere convenient, or leave the window up until you need to use it.

Adding a Docker Hub Image Registry to Flightcontrol

Let's use our access token to setup an image registry on Flightcontrol. Choose Image Registries from the sidebar in the dashboard.

Add an Image Registry

Click the Add an Image Registry button to add a new image registry.

Add an Image Registry to Flightcontrol

Choose the Docker Hub Registry Type

When you add a new image registry, you'll need to choose the registry type. We'll pick Docker Hub.

New Image Registry page on Flightcontrol

Add your Docker Hub Username and Access Token

After choosing the Docker Hub registry type, you'll need to enter your Docker Hub username and access token. The access token goes into the password field.

Username and Password input fields for a Docker Hub Image Registry

Because you configured a read-only access token, Flightcontrol will be able to pull images from your Docker Hub account.

After connecting your Docker Hub image registry to Flightcontrol, you can deploy your Docker images to AWS ECS Fargate.

Creating a Flightcontrol Project

Now, let's create a Flightcontrol project to deploy the Docker images from your Docker Hub image registry.

Create a new project in the Flightcontrol dashboard and choose a GitHub source code repository to use. You can choose a public or private repository. While Flightcontrol won't use the source code in the repository to produce a build, you can use a flightcontrol.json file in the repository to configure your project.

For this guide, we'll use the Flightcontrol dashboard to setup our project, instead of configuring with code using flightcontrol.json.

We'll start with an empty project, and add a web server service to it. Click the Add Web Service (Fargate) button to add a web server service to your project.

Add a Web Server service

Configuring the Web Server Service

After the Web Server service is added to your project, you'll need to configure it. The default build type is Nixpacks, so we will need to change the build type to "Pull from Image Registry".

Once we change the build type, a new set of configuration options will appear. Choose the Docker Hub image registry you created earlier, and enter the name of the Docker image you want to deploy. Typically, you will want to use the latest tag for your image, but you can use any tag here.

Configuring the Image Registry Build Type

You also need to provide a descriptive name for your web server service.

Configuring AWS and Creating the Project

Flightcontrol needs to know which AWS account to deploy your project to. You can either choose an existing AWS account, or create a new one.

You also need to select an AWS region, such as us-east-1 or us-west-2.

If your project needs any environment variables, you can add them now to the dashboard.

You can also add any auxiliary services your project needs, such as a database or Redis cache.

Once you've selected an AWS account and region, you can create your project with the Create Project button.

Configuring AWS and Environment Variables

Flightcontrol will pull your Docker image from Docker Hub, and then deploy it to AWS ECS Fargate.

Right now, this is a manual process, but we will want to automate this. After a successful build that pushes a new image to Docker Hub, your build pipeline would trigger a deployment with Flightcontrol.

Automating the Deployment Process

Flightcontrol supports Deploy Hooks (opens in a new tab), which are webhooks your applications can use to trigger a deployment with Flightcontrol.

Creating a Deploy Hook

Let's create a deploy hook for our project. Find the Trigger Deploy Hooks section in the environment dashboard. Fill in a name for your hook, and then click on the Create Deploy Hook button.

Create Deploy Hook

After naming and creating the deploy hook, you'll see the URL for the deploy hook. You can use this URL to trigger a deployment with Flightcontrol.

After Deploy Hook was created, showing deployment URL

Treat the deploy hook URL like a password - anyone with the URL can trigger a deployment with Flightcontrol. If you need to revoke access to the deploy hook URL, you can delete the deploy hook and create a new one.

Triggering a Deployment

You can trigger a deployment with Flightcontrol by sending an HTTP GET request to the deploy hook URL. You can load the URL in your web browser if you want to test it out.

After triggering a deployment, you'll see the deployment in the Deployments section of the envrionment dashboard.

Deployments tab after triggering a deployment

After making a GET request to the deploy hook URL, you'll get a JSON response with the deployment ID from Flightcontrol.

  "success": true,
  "deploymentId": "clijekhhm0j9krxxxxxxxxxzz"

You can use the deployment ID to check the status of the deployment with the Get Deployment API. You will need an API Key to use the Get Deployment API.


Using these tools, you can automate your continuous delivery (CD) to deploy your Docker images to AWS ECS Fargate with Flightcontrol.

You can use the build pipeline you already have to build and push your Docker images to Docker Hub, and then trigger a deployment with Flightcontrol.