How to manage images

An image is the base for a container running in the Anbox Cloud. It contains all necessary components, like Anbox or the Android root file system. Each release of Anbox Cloud comes with an updated image.

See Provided images for information about which images Anbox Cloud provides.

Configure image server

Using the image server hosted by Canonical enables automated updates on your Anbox Cloud deployment. AMS will automatically synchronise new image versions in regular intervals and update your applications. Using the image server should be preferred over using manually managed images. Images on the image server are updated for important security updates or bug fixes, and with every release of Anbox Cloud.

Starting with Anbox Cloud 1.9, access to the image server is automatically configured as part of your Ubuntu Advantage subscription during the charm deployment. No further manual steps are necessary.

AMS will start automatically to import images available on the image server. The images.update_interval configuration option allows to customise how often AMS looks for new images. You can set it to a desired interval with the following command:

amc config set images.update_interval 5m

Synchronised images will become available next to images you manually add:

|          ID          |            NAME             | STATUS | VERSIONS |
| bj03g89hpuo10ed1riog | io.anbox-cloud:nougat:amd64 | active | 1        |
| bj003kphpuo2bt5edjtg | default                     | active | 1        |

Default image

When adding your first image to AMS, it is marked as the default image.
The default image is used when you create an application without the image field or launch a raw container without specifying any ID.

You can set any image as your default with the following command:

amc image switch bcpm2r2hmss0427lkrn0

Running amc image list will now show this image marked as default.

Hint: Note that you cannot delete an image marked as default. You’ll need to set a new default image first. (does not apply if you only have one image left)

Delete an image

Deleting an image will make it unavailable to Anbox Cloud. However, it will not affect any application based on the image directly, as the application keeps a copy of the image internally. As the image is not available to AMS anymore after deleting it, updating the underlying image of applications with a new version is not possible anymore.

Deleting a specific image can be achieved with the following command, where default is the name of the image to delete:

amc image delete default

Images that are synchronised from the image server are marked as immutable. To delete such images, add the --force flag:

amc image delete --force io.anbox-cloud:nougat:amd64

If you’re not using --force, the command will fail.

Delete an image version

Specific image versions can be deleted too, which is useful when all applications were migrated to a newer version and the old version is not needed anymore. The only requirement is that a single version of the image is available at all times.

The following command removes version 1 of the image with the name default:

amc image delete default --version=1

Use a specific release of an image

With every new Anbox Cloud release, updated images are published. By default, the latest image release is pulled by AMS, but you can request a specific release with the following syntax:

amc image add <local image name> <remote image name>@<release>

For instance, to fetch the arm64 Android 11 image of the 1.11.2 release:

amc image add foobar bionic:android11:arm64@1.11.2

You can then use the foobar image as you would any other image.

Tip: Image updates contain important security patches and optimisations. Use older images only when strictly necessary.

Manual upload of images

In addition to the images provided through Canonical’s image server, you can manually upload your own images to be used by AMS.

You must choose a name for the image when uploading it. If you update the image later, use the same name so that the image is not re-created but simply updated.

Add an image to AMS

Adding an image to AMS can be done with the following command:

amc image add default anbox-lxd-jammy_x.y_amd64.tar.xz

default is the name assigned to the new image. The name can be used by applications to reference the image.

Each image gets a unique ID assigned which can be used to retrieve further information about the image with amc image show <ID>:

id: bcpm2r2hmss0427lkrn0
name: default
status: active
        size: 374.69MB
        created-at: 2018-06-27 10:05:32 +0000 UTC
        status: active

Similar to applications managed by AMS (see About applications), images have a list of versions too. A new version is created each time an image is updated.

Update an existing image

Use the following command to update a manually uploaded image in AMS:

amc image update default anbox-lxd-jammy_x.y_amd64.tar.xz

default is the name assigned to the existing image. Uploading the new image to the connected LXD cluster will take a moment. Once the upload has finished, the image is marked as active.

Now that a new image version is available to AMS, it will start to create new versions of all available applications but won’t publish them. Creating new versions of each application can take a moment depending on the current load of the cluster. You can see available versions of a specific application with the following command:

amc application show <id>

Each version will give information about which version of an image it is based on.

1 Like