Run Android Emulator on Docker

Andres Sandoval
3 min readApr 4, 2018

How to build and run Android Emulator on a Docker container, run locally on MacBook. Assumption Docker is installed. I learned about Docker from this GitHub tutorial. In this tutorial, we will create and run an Android Emulator inside a Docker container.

1. Pull the Android Docker images.

a. Open Docker application on MacBook.

b. Open a new terminal and enter below commands:

//Pulls android-sdk image
docker pull thyrlian/android-sdk
//Pulls android-sdk-vnc image
docker pull thyrlian/android-sdk-vnc
//Runs android sdk on container
docker run -it — rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'

2. Modified below command to use your file ssh key path “../../ssh/”

docker run -d -p 5901:5901 -p 2222:22 -p 5037:5037 -v $(pwd)/sdk:/opt/android-sdk -v /Users/asandoval/.ssh/ thyrlian/android-sdk-vnc

3. Open new terminal and SSH into container. Use below command to install Android emulator components

ssh root@ -p 2222 //enter your SSH id_rsa key password
ssh to Docker container

Enter below commands to download Android emulator components:

sdkmanager "platform-tools" "platforms;android-24" "emulator"sdkmanager "system-images;android-24;default;armeabi-v7a"

Enter below commands to create new Android Emulator:

avdmanager create avd -n emuTest -k "system-images;android-24;default;armeabi-v7a"emulator -avd emuTest -noaudio -no-boot-anim -gpu off

4. The Android emulator is starting inside Docker container

Now VNC to the container. With VNC you are able to see the emulator. You will have an android emulator running on your virtual machine “container”

a. On MacBook open application “Screen Sharing”.

b. Enter below:

vnc:// (password: android)