Containers are the centre piece of the Anbox Cloud stack. Every time you launch an application or an image, Anbox Cloud creates a container for it. Every container provides a full Android system.
Regular containers vs. base containers
Anbox Cloud differentiates between two types of containers: regular containers and base containers. The container type is visible in the output of the
amc ls command.
Regular containers are containers that are launched from either an application or an image. They exist until they are deleted.
Base containers are temporary containers that are used when bootstrapping an application. They are automatically deleted when the application bootstrap is completed.
When we refer to containers in this documentation without specifying the container type, we mean regular containers.
Application containers vs. raw containers
Containers are based on either applications or images. That means that if you launch an application or an image, AMS automatically creates a container for it.
Application containers, thus containers created when launching an application, run the full Android system. If the application is based on an Android app (an APK package), this app is launched after the system boots and monitored by the watchdog. With the default configuration, you will see only the app and not the Android launcher.
Containers that are created when launching an image are called raw containers. They run the full Android system, without any additional apps installed.
Data stored in containers
All containers in Anbox Cloud are ephemeral, which means that as soon as a container is stopped, all of its data is gone. Anbox Cloud DOES NOT back up any data from the Android or the outer Ubuntu container. Backup and restore of data must be implemented separately through addons. See Example: Back up data for information on how to do this.
Container life cycle
When you create a container by either launching or initialising an application or an image, AMS schedules the container on a LXD node. The container then executes the following steps in order:
- Configure the network interface and gateway.
- Only raw containers: Install addons that are specified with
- Expose services that are specified with
--serviceor through the application manifest.
- Execute the
pre-starthook provided by the installed addons.
- Launch the Android container.
- Execute the
post-starthook provided by the installed addons.
The whole launch process is successful only if all of the above steps succeed.
If anything goes wrong during the container launch process, the status of the container changes to the
error status. You can view the available logs from the container for diagnosing the root cause of the problem.
Containers can be stopped because of the following scenarios:
- You stopped it.
- You deleted it.
- An error occurred.
When a container is stopped, it executes the following steps in order:
- Stop the Android container.
- Execute the
post-stophook provided by the installed addons.
- Shut down the container.
Beyond that, the container will be removed from AMS either because you deleted it or because an error occurred during its runtime.
Possible container status
Throughout its lifetime, a container moves through different stages depending on the state it’s currently in.
||AMS has created an internal database object for the container and will schedule the container onto a suitable LXD node next.|
||AMS has decided on which LXD node the container will be placed.|
||The container was started and is now booting. During the boot sequence, possible hooks are executed. Only when all hooks have been executed, the container will switch to
||The container is fully up and running.|
||The container is fully stopped and will be deleted by AMS.|
||The container is deleted and will be removed from the AMS database soon.|
||An error occurred while processing the container. The container is stopped. Further information about the error can be viewed with
AMS allows to start a container in development mode. This mode turns off some features that are usually active in a container. It is mainly useful when developing addons inside a container.
When development mode is enabled, the container does not send status updates to AMS when the Anbox runtime is terminated. This allows you to restart the Anbox runtime inside the container, providing an easy way to test addons or other extensions.
To check whether development mode is enabled, run
amc show <container_ID> or look at the
/var/lib/anbox/session.yaml file in the container. If the
devmode field in the configuration file is set to
true, development mode is active.
- How to create a container
- How to start a container
- How to wait for a container
- How to access a container
- How to expose services on a container
- How to view the container logs
- How to stop a container
- How to delete a container
- How to list containers
- How to configure geographic location
- How to back up and restore application data