Instances are the centre piece of the Anbox Cloud stack. Every time you launch an application or an image, Anbox Cloud creates an instance for it. Every instance provides a full Android system.
All instances in Anbox Cloud are ephemeral, which means that as soon as an instance is stopped, all of its data is deleted. Anbox Cloud DOES NOT back up any data from the Android or the outer Ubuntu instance. Backup and restore of data must be implemented separately through addons. See Example: Back up data for information on how to do this.
Anbox Cloud differentiates between two types of instances: regular and base. The instance type is visible in the output of the
amc ls command.
Regular instances are containers or virtual machines that are launched from either an application or an image. They exist until they are deleted.
Base instances are temporary containers or virtual machines that are used when bootstrapping an application. They are automatically deleted when the application bootstrap is completed.
When we refer to instances in this documentation without specifying the instance type, we mean regular instances.
Application instances are containers or virtual machines created when launching an application and 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.
Raw instances are containers or virtual machines created when launching an image. They run the full Android system, without any additional apps installed.
When you create an instance by either launching or initialising an application or an image, AMS schedules the instance on a LXD node. The instance then executes the following steps in order:
- Configure the network interface and gateway.
- (Only for raw instances) 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.
Launching an instance is successful only if all of the above steps succeed. If there are issues during the process, the status of the instance changes to
error. You can view the available logs from the instance for further troubleshooting.
Instances can be stopped because of the following scenarios:
- You stopped it.
- You deleted it.
- An error occurred.
When an instance 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 instance.
Beyond that, the instance will be removed from AMS either because you deleted it or because an error occurred during its runtime.
An instance moves through different stages and correspondingly can have the following status depending on its current state.
|AMS has created an internal database object for the instance and will next schedule the instance onto a suitable LXD node.
|AMS has decided the LXD node on which it will schedule the instance.
|The instance is started and now booting. During the boot sequence, possible hooks are executed. Only when all hooks have been executed, the instance will switch to
|The instance is fully up and running.
|The instance is fully stopped and will be deleted by AMS.
|The instance is deleted and will be removed from the AMS database soon.
|An error occurred while processing the instance. The instance is stopped. Further information about the error can be viewed with
amc show <instance id>.
AMS allows to start an instance in development mode. This mode turns off some features that are usually active in an instance. It is mainly useful when developing addons inside an instance.
When development mode is enabled, the instance sends status updates to AMS when the Anbox runtime is terminated, however, AMS allows the instance to continue running. This allows you to restart the Anbox runtime inside the instance, providing an easy way to test addons or develop a platform plugin.
To check whether development mode is enabled, run
amc show <instance_ID> or look at the
/var/lib/anbox/session.yaml file in the instance. If the
devmode field in the configuration file is set to
true, development mode is active.
- How to create an instance
- How to start an instance
- How to wait for an instance
- How to access an instance
- How to expose services on an instance
- How to view the instance logs
- How to stop an instance
- How to delete an instance
- How to list instances
- How to configure geographic location
- How to back up and restore application data