Docker image for desktop development using Android Studio, based on menny/android_ndk image.
323
Docker image for desktop development using Android Studio, based on menny/android_ndk image.
Like this (artifacts only in the screenshot, not in real life):

Read about this at the general Android Docker image.
Build image: docker build -t menny/android_studio:latest .
Pull from Docker Hub: docker pull menny/android_studio:latest
To work with the Android Studio inside this Docker image, you'll need to run it and direct its X11 connection to the local (host) machine X-Server.
Note: The following instructions come from here and here.
I assume you have an X-Server, and it accepts network connections.
If you have a Mac, you will need to install xquartz. Run:
brew cask install xquartz
Start xquartz:
open -a XQuartz
And allow network connections in the Preferences window. More details here.
Add your machine's local IP to xhost:
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
/opt/X11/bin/xhost + $ip
And run Android Studio:
docker run -d -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix menny/android_studio:1.8.1
Probably just:
docker run -d -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix menny/android_studio:1.8.1
No idea.
The process above will give you a blank installation of Android Studio. It's a nice PoC, but the downside is that every time you start the Docker image, you start in the same blank state.
My workflow is as follow:
id_rsa keys into the Docker image, that's in case you need those keys for cloning your repo.docker exec -it hardcore_meninsky bash
This will open a bash terminal inside the running Docker image (use docker ps --all to find the image name, in my example the name was hardcore_meninsky). Run these commands:
mkdir -p /root/.ssh
chmod 0700 /root/.ssh
exit
Back in the host terminal, copy the ssh keys into the image:
docker cp ~/.ssh/id_rsa hardcore_meninsky:/root/.ssh/
docker cp ~/.ssh/id_rsa.pub hardcore_meninsky:/root/.ssh/
local.properties file in your checkout repo. Add the SDK and NDK paths:ndk.dir=/opt/android-ndk-linux
sdk.dir=/opt/android-sdk-linux
docker ps --all. You'll see the Android Studio container (probably the top-most) in exited status. Copy it's name (last column). For example:➜ docker ps --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
daffb7bbee3f menny/android_studio:1.8.1 "/opt/android-stud..." 21 minutes ago Exited (0) 11 seconds ago hardcore_meninsky
docker commit hardcore_meninsky warm_android_studio. This might take a while.docker run -d -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix warm_android_studiodocker start hardcore_meninsky. This will start the container with all the changes you made.Content type
Image
Digest
Size
3 GB
Last updated
almost 9 years ago
docker pull menny/android_studio:1.8.2