Importing an Image

Prerequisites

Importing an image is two steps:

  1. Create an Image Source
  2. Import an Image

Creating the Image Source

After logging into the portal, click on the Images tab on the left-hand side of the screen. With that expanded, click on Sources.

If this is a new hub, no images will exist yet, but if joining an existing hub, all available images on the hub will be listed here.

Opening the Modal

To start creating a new image source, click the Create button at the top of the page. This will open a modal with a form that allows the following image configuration options:

Each of these image source types will have slightly different options the platform will use to locate, download, and create the image.

This document will cover the Dockerfile (Git Repo) type, but the links above have detailed information on each of the possible image types.

Dockerfile Config

  • TL;DR: Use the link below to add the git repo URL and leave all other fields as their default, then click Create Image Source.

After selecting the Docker File - Git Repo option from the dropdown, a configuration form will appear. This companion repo is available to assist with this step.

Clicking the link to the Git Repo reveals a basic website based on create-react-app, with a Dockerfile located in the root of the repository.

The first field in the configuration for the image source is Git Repo URL, which supports both HTTP and SSH-based pulling; however, HTTP will be used in this instance. The Git Repo Branch field allows for specifying any branch in the repository to be used when creating images. The default is set to main, so it can be left blank when following along with the companion repo.

The Context Directory and Build File fields require particular attention.

Context Directory

  • Specifies the location within the repository that is treated as the context when executing steps in the Dockerfile.
  • If the Dockerfile includes a step that says COPY ./ ./ and the context directory is set to /, Cycle will copy everything from the root of the repository into the image.
  • Default Value : /

Build File

  • Indicates the location of the Dockerfile within the repository that should be used for this image source.
  • If the Dockerfile is located in the root of the repository, as it is in the companion repo, /Dockerfile should be entered in this field.
  • Default Value: /Dockerfile

image git section

In many cases, the default values are the desired values, and if that is the case, the fields can be left blank.

To recap, copy the HTTPS clone URL from the repo and into the Git Repo URL field. Then, leave all other fields blank (if using the companion repo to follow along).

Once these steps have been completed, click on Create Image Source.

Import The Image

With the image source created it is now possible to create new copies of the container image. To create a copy of the image click and hold down the Import Image button at the top of the page. The image will go through several states and then end up in the live state.

Each copy of the image is a point-in-time reference to the files present in the repo at the time of image creation. Adding new images does not replace or change anything in the existing image. Instead, a new copy is created. This makes it much easier to roll back to a previous version of the image if necessary.