Android Studio in a non-privileged docker container running as a X11 window.
- Android Studio IntelliJ IDE
- Android emulator (hardware acceleration, sound, keyboard input)
- Requires
KVM
- Requires
PulseAudio
running on the host for sound - Hardware acceleration using OpenGL via
/dev/dri
- Requires
- Plugging in an Android phone via USB
The current user id, current group id and KVM group id is baked into the container. Running the container as more than one user isn't supported. Note that on some systems the KVM group id is dynamic and changes on boot which means the container will have to be rebuilt.
docker-android-studio$ bin/build
- Either create a file called
.env
(in the same directory as theDockerfile
) or export the following environment variables:
Name | Description | Container Volume | Example |
---|---|---|---|
DATA_DIR | Directory containing android projects | /data | $HOME/AndroidStudioProjects |
STUDIO_DIR | Directory to store persistent data such as Android SDK and Android Emulator files | /var/studio | $HOME/.android-dev |
docker-android-studio$ bin/start
A wizard appears the first time the studio is run.
- Complete Installation:
Do not import settings
- Welcome: (next)
- Install Type:
Custom
- SDK Components Setup: Select what's required and change the Android SDK Location to:
/var/studio/Android/Sdk
- Verify Settings: (next)
- Emulator Settings: (finish)
The following files can be placed in the config/
directory to be included in the image:
idea.properties
studio64.vmoptions
dbus
errors when running Android Emulator.- The package
xserver-xorg-input-void
pulls in a dependency which might change keyboard layout on the host system.