External Registries
Public Registries
BeetleboxCI has the capability to pull images from external public registries, besides its own internal image registry. For example, it can pull public images from Amazon's Elastic Container Registry. The example below shows the YAML configuration to select an Ubuntu image that is provided by Beetlebox.
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
You can also pull images from Dockerhub. In this case, you do not have to specify the location of the image, because Kubernetes (the base platform for BeetleboxCI) automatically checks Dockerhub if the location if not specfied. You can therefore use the latest Ubuntu container image available on Dockerhub to run a job, by using the following code in the YAML configuration file:
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
Private Registries
BeetleboxCI currently does not have the capability to pull images directly from external private registries, but it is a feature that will be added in due course. For the time being, it would be necessary to pull and add that image to the local BeetleboxCI registry in order to use it. The sections below describe how it can be done.
Adding Images
You can add more images to the local registry from online registries. The BeetleboxCI webapp provides a straightforward interface for generating scripts to add new images to your local registry.
- In the web interface, click Images in the left hand column to take you to the images page.
- Click the add image button to open pop-up to enter the details of the image that you wish to add.
- Enter the name of the remote image to add, for example
public.ecr.aws/y2s4f3y9/ubuntu-generic
. - If the image is being pulled from a public registry, check the box to indicate this.
- Click submit and a script will be generated and downloaded.
- Run this script on the (virtual) machine where BeetleboxCI is installed.
- If the image is being pulled from a private registry, you will be prompted for the login details to access the registry before the image begins to download. Otherwise, the image download will begin immediately.
Adding Images Manually
If you wish, you can add images to the local registry manually, using terminal commands in the (virtual) machine where BeetleboxCI is installed. This allows you to rename the image. Let's say you want to pull the Ubuntu image that Beetlebox provides and push it to the local registry under a different name. We can use the command mentioned earlier to pull the image from the public registry:
Since we are pulling from a public registry, it is not necessary to provide any authentication details.
If you are pulling from a private registry, it would be necessary to provide authentication details to the registry using the docker login
command before pulling the image.
docker pull public.ecr.aws/y2s4f3y9/ubuntu-generic
Then you can use the docker images
command to list the images that are cached on the machine:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
public.ecr.aws/y2s4f3y9/ubuntu-generic latest 20d7050f100c 3 months ago 719MB
We need to tag this image by specifying its ID and specifying the name of the tag:
docker tag 20d7050f100c work1-virtualbox:5000/ubuntu-renamed:latest
Tagging adds a new name to the image, which now includes the name of the local registry rather than the name of the remote registry. This step is necessary to do in order to push it to our local registry. You may wish to call the docker images
command again to see the newly tagged image being listed.
Then we can push this image to the local registry, using the tag that we just created:
docker push work1-virtualbox:5000/ubuntu-renamed:latest
Now this image in the local registry can be used to run jobs by including the following in the .bbx/config.yaml file in your git repository.
runners:
ubuntu-runner:
image: work1-virtualbox:5000/ubuntu-renamed:latest