Starting and Uninstalling a Cloud Phone
Ensure that the kbox_config.cfg file exists in the startup path of the cloud phone instance. The container uses the configuration in this file. Therefore, ensure that the configuration in the kbox_config.cfg file is correct. If the configuration file does not exist in the startup path, the cloud phone cannot be started.
The kbox_config.cfg file contains configuration items such as KBOX_GPU_MAP, KBOX_MOUNT_MAP, and KBOX_CPUSET_MAP. You can change the value of the corresponding channel in the maps to select the GPU, CPU, and data volume storage path used by a container. You can use the kbox_config.cfg file to flexibly configure the resources used by cloud phones to achieve optimal performance.
The Kbox cloud phone container allows users to customize and overwrite system properties as required. To use custom properties, create a local.prop file in the startup path to record custom system properties. After a container is started, properties in this file are read to overwrite the original properties during container initialization. For details, see "Customizing Android System Properties" in the Kbox Cloud Phone Container Routine Maintenance.
- Decompress Kbox-AOSP11.zip and upload the deploy_scripts directory in the Kbox-AOSP11 folder to the ~/dependency directory on the server.
- (Optional) To enable hardware decoding, set ENABLE_HARD_DECODE to 1 in the kbox_config.cfg file in the deploy_scripts directory.
If software decoding is used during startup, that is, ENABLE_HARD_DECODE is set to 0, the decoding mode can be switched to hardware decoding during restart by setting ENABLE_HARD_DECODE to 1.
- Run the android11_kbox.sh script to start containers.
1 2 3
cd ~/dependency/deploy_scripts chmod +x android11_kbox.sh ./android11_kbox.sh start {image_name:tag} ${index1} ${index2}
Table 1 lists the default configurations of a Kbox basic cloud phone.
Table 1 Default configurations Configuration Item
Kbox Basic Cloud Phone
Scenario
Mobile office/hosting
vCPU
2
CPU core binding policy
2 containers, 2 cores
Memory
6 GB
System storage
16 GB
Resolution
720 x 1280
The following are examples of using the startup script:
- Start instance 1.
1./android11_kbox.sh start kbox:origin 1
- Start instances 1 to 5.
1./android11_kbox.sh start kbox:origin 1 5
- Start instance 1.
- Run the following command to check whether the Kbox container is started successfully. ${index} indicates the ID of the instance.
1docker exec -it kbox_${index} getprop | grep boot_completed
In the output, if the value of sys.boot_completed is 1, the startup is successful.
- Stop and delete Kbox containers.
In the Kbox solution, data volumes are mounted by default. The default docker stop and docker rm commands cannot completely clear container data. Run the following script to completely clear files on the host.
Run the android11_kbox.sh script to stop and delete a running Kbox container.
- Stop and delete the container whose ID is ${index}.
1./android11_kbox.sh delete ${index}
- Stop and delete all the containers numbered from ${index1} to ${index2}.
1./android11_kbox.sh delete ${index1} ${index2}
- Stop and delete the container whose ID is ${index}.
- Restart Kbox containers.
In the Kbox solution, data volumes are mounted by default. The default docker restart command cannot restart a container. Instead, run the following script to restart a container.
Run the android11_kbox.sh script to restart Kbox containers.
- Restart the container numbered ${index}.
1./android11_kbox.sh restart ${index}
- Restart all the containers numbered from ${index1} to ${index2}.
1./android11_kbox.sh restart ${index1} ${index2}
- Restart the container numbered ${index}.