Container scripts for external releases

This is a set of minimal scripts to run the emulator in a container for various systems such as Docker, for external consumption. Acloud is not used; only the emulator and system image zip files are needed.

We do similar things as the internal facing scripts, but is meant for external release. When the container images are built, they can be separately pushed to some location such as docker hub or even


The following Python libraries are required:



We have two scripts that work together to provide emulator docker images: sets up a Docker image source directory with a Dockerfile that is buildable and runnable as a Docker image, given a Linux emulator zip file, a system image zip file, and a docker repo name (currently unused; any name will do). lists a set of publically available Android Emulator system images and emulators along with their URLs, which makes it easier to download zip files for user with

Obtaining URLs for emulator/system image zip files



will query the currently published Android SDK and output URLs for the zip files of:

  • Available and currently Docker-compatible system images
  • Currently published and advertised emulator binaries

For each system image, the API level, variant, ABI, and URL are displayed. For each emulator, the update channel (stable vs canary), version, host os, and URL are displayed.

Example output:

SYSIMG android 21 L x86_64
SYSIMG android 22 L x86_64
SYSIMG android 23 M x86_64
SYSIMG android 24 N x86_64
SYSIMG android 25 N x86_64
SYSIMG android 26 O x86_64
SYSIMG android 27 O x86_64
SYSIMG android 28 P x86_64
SYSIMG android 28 Q x86_64
SYSIMG google_apis 21 L x86_64
SYSIMG google_apis 22 L x86_64
SYSIMG google_apis 23 M x86_64
SYSIMG google_apis 24 N x86_64
SYSIMG google_apis 25 N x86_64
SYSIMG google_apis 26 O x86_64
SYSIMG google_apis 28 P x86_64
SYSIMG google_apis 28 Q x86_64
SYSIMG google_apis_playstore 28 P x86_64
SYSIMG google_apis_playstore 28 Q x86_64
EMU stable 29.0.11 windows
EMU stable 29.0.11 macosx
EMU stable 29.0.11 linux
EMU stable 28.0.25 windows
EMU canary 29.0.12 windows
EMU canary 29.0.12 macosx
EMU canary 29.0.12 linux

One can then use tools like wget or a browser to download a desired emulator and system image. After the two are obtained, we can build a Docker image.

Building the Docker image: Setting up the source dir

Given an emulator zip file and a system image zip file, we can build a directory that can be sent to docker build via the following invocation of

python <emulator-zip> <system-image-zip> <docker-repo-name(unused currently)> [docker-src-dir (getcwd()/src by default)]

This places all the right elements to run a docker image, but does not build, run or publish yet. A Linux emulator zip file must be used.

To build the Docker image corresponding to these emulators and system images:

docker build <docker-src-dir, either ./src or specified argument to>

A Docker image ID will output; save this image ID.

Running the Docker image

We currently assume that KVM will be used with docker in order to provide CPU virtualization capabilties to the resulting Docker image.

We provide the following run script:

./ <docker-image-id>

It does the following:

docker run -e "ADBKEY=$(cat ~/.android/adbkey)" --privileged  --publish 5556:5556/tcp --publish 5555:5555/tcp <docker-image-id>
  • Sets up the ADB key, assuming one exists at ~/.android/adbkey
  • Uses --privileged to have CPU acceleration
  • Starts the emulator in the docker image with its gRPC service, forwarding the host ports 5556/5554 to container ports 5554/5554 respectively.
  • The gRPC service is used to communicate with the running emulator inside the container.

Communicating with the emulator in the container


We forward the port 5555 for adb access to the emulator running inside the container (TODO: make this configurable per container).

To enable ADB access, run the following adb command, assuming no other emulators/devices connected:

adb connect localhost:5555


We use a gRPC/webrtc service to show what is on the emulator and to interact with it. This assumes that you have npm/node plus protoc 3.6+ installed and available, and that no other node servers are running on your machine.

Checkout the emulator repo dir:

In the /js dir, issue:

make deps # Uses npm and protoc 3.6+ libraries to build the client
make develop # Runs the service

and point your web browser to localhost:3000.

To stop, hit Ctrl-C in the terminal where make develop was issued, then issue:

make stop

TODO: We are also working on a more isolated solution via envoy, nginx, and docker-compose. See

Local run of any emulator/system image zip combo

It can be useful to do local debugging of a particular emulator/system image outside the container.

  1. Download any emulator/system image zip folder, unzip somewhere and note the resulting emulator/ and x86_64/ folders.
  2. python emulator/ x86_64/ (or resulting paths to emulator/system image folder if different)
  3. This creates an AVD and defaults to putting the -no-snapshot, -show-kernel flags.

TODO: Support other arch's than x64