Create a Custom Image

Image Creation

  1. When logged in to the Control Panel click on Containers in the left menu.
  2. Click on the Images link below Containers.
  3. Click the Create Image button.
  4. Type in the label for your image.
  5. Choose whether to fork an existing image by using the "Fork From" selector.
  6. Add an ssh key to the image.
  7. Click Create Image to start the creation process.
  8. Once your image has been created click on its name in the list of images to see more details.
  9. Here are the details of your image, the version history (empty for now) and the repository url.
  10. Copy the repository url so you can clone the repository locally.
  11. To open and edit the repository locally do the following in to your terminal (swapping the repository url for your own):
$ git clone git@gitlab-clients.sitehost.co.nz:g_1/my-custom-image.git
$ cd ./my-custom-image
  1. Once this is done you can make edits to your images and commit them back where the image will be built ready to be used in a Cloud Container.

Image Contents

Inside our repository you will find all the files and folder structure we need to build a custom image.

$ ls -lah
 > drwxrwxr-x  6 user user 4.0K Nov 28 12:04 default-data
 > -rw-rw-r--  1 user user   67 Nov 28 12:04 Dockerfile
 > drwxrwxr-x  8 user user 4.0K Nov 28 12:04 .git
 > -rw-rw-r--  1 user user  605 Nov 28 12:04 .gitlab-ci.yml
 > -rw-rw-r--  1 user user  393 Nov 28 12:04 manifest.yml

As you can see our repository contains three files: .gitlab-ci.yml, manifest.yml and Dockerfile These three files are mandatory in every custom image, they define exactly how to build your custom image.

When making a custom image from scratch, you will mainly be changing manifest.yml and Dockerfile. You can read more about the manifest.yml file.

The .gitlab-ci.yml file is used to build your custom image in our CI environment, we do not allow any changes to this file. Any commit that alters this file will be rejected.

You will also notice the default-data directory. This is where you store the files needed for your custom image. For more information please read about the default-data directory.

Updating an Image

Images can only be edited locally so you will have to have a copy of the repository on your local machine. After editing a file(s) in the repository you can commit them back to SiteHost for us to build the image by doing the following:

git add ./Dockerfile
git commit -m "Update Dockerfile"
git push   

While the image is building you can view the build status and build log from within the Control Panel.

Viewing Build Status and Build Log

  1. When logged in to the Control Panel click on Containers in the left menu.
  2. Click on the Images link below Containers.
  3. Click on the image name of the image you wish to view.
  4. Under the "History" title you can see previous versions that have been pushed.
  5. The icon to the left indicates whether the build was sucessful or not.
  6. You can see more detail by clicking on the View Log link.