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/id_rsa.pub”

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

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

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

Enter below commands to download Android emulator components:

sdkmanager…

--

--