This project provides a base Docker image configured with Android SDK, Appium, Device-Farm plugin, and UIAutomator. It is designed to be used as a foundation for creating custom Docker images that run Android emulators. The base image includes all necessary setups to create and run emulators and also supports using Appium in a node or hub configuration.
You can use this image to build your own Docker container with emulators, run Appium, or just use it for Android development purposes.
- Project Overview
- Prerequisites
- Requirements
- How to Build
- How to Run
- Docker Image Details
- Troubleshooting
- License
- Base Image: This image is intended to be used as a starting point for creating custom Docker images that run Android emulators.
- Appium Integration: Appium is pre-configured with the Device-Farm plugin and UIAutomator to run automated tests on Android emulators.
- Customizable: You can configure the image to either automatically run Appium or use it purely as an emulator environment for Android development.
- Docker
- Basic knowledge of Appium and Android Emulator setup
- Docker (version 20.10+)
To build the Docker image without any specific arguments, run the following command:
docker build -t android-appium .This command uses the default BUILD_TOOLS_VERSION=35.0.0 and other configurations as specified in the Dockerfile.
To pass custom arguments during the build process, use the --build-arg flag. For example:
docker build --build-arg BUILD_TOOLS_VERSION=36.0.0 --build-arg ANDROID_VERSION=14 -t android-appium .This will build the Docker image using the specified BUILD_TOOLS_VERSION and ANDROID_VERSION .
To run the Docker image using the default configuration (Appium not running), use the following command:
docker run -it android-appiumThis will start the container and leave you in a bash shell with the default Android environment.
To start the Docker container with customized variables (for example, running Appium), you can pass the necessary environment variables when running the container. Example:
docker run -it -e APPIUM=true -e APPIUM_PORT=4725 android-appiumThis will start Appium with the custom port (4725), instead of the default (4723) .
You can pass other environment variables to customize the Appium server configuration. Some of the key variables are:
APPIUM=trueto start Appium serverAPPIUM_PORT=4723to set the Appium portKEEP_ALIVE=600to specify the keep-alive timeout (in milliseconds)HUB_ADDRESSto set a specific hub address for the Appium server to connect to
Example:
docker run -it -e APPIUM=true -e APPIUM_PORT=4725 -e HUB_ADDRESS="hub.example.com" android-appiumThe Docker image is based on the official Android SDK image and is preconfigured with Android SDK packages and build tools.
| Android Version | API Level |
|---|---|
| Android15 | 35 |
| Android14 | 34 |
| Android13 | 33 |
| Android12L | 32 |
| Android12 | 31 |
| Android11 | 30 |
| Android10 | 29 |
| Android9 | 28 |
| Variable | Description | Default Value |
|---|---|---|
BUILD_TOOLS_VERSION |
Specifies the version of the Android Build Tools to install. | 35.0.0 |
ANDROID_VERSION |
Specifies the Android version to use for the base image. | 13 |
API_LEVEL |
Defines the Android API level to be installed. | 33 |
ARCH |
Architecture for the Android emulator image (e.g., x86_64). |
x86_64 |
TARGET |
The target platform for the emulator (e.g., google_apis_playstore). |
google_apis_playstore |
EMULATOR_PACKAGE |
Android system image package to install for emulators. | system-images;android-33;google_apis_playstore;x86_64 |
PLATFORM_VERSION |
The platform version for the Android SDK. | platforms;android-33 |
ANDROID_SDK_PACKAGES |
List of Android SDK packages to install. | ${EMULATOR_PACKAGE} ${PLATFORM_VERSION} |
| Variable | Description | Default Value |
|---|---|---|
APPIUM |
Whether to start Appium or not. Set to true to run Appium. |
false |
APPIUM_PORT |
The port on which Appium will run. | 4723 |
KEEP_ALIVE |
The keep-alive timeout in milliseconds for the Appium server. | 600 |
HUB_ADDRESS |
The address of the Appium Hub, if using a hub setup. | "" (empty) |
- If Appium fails to start, check the logs for errors. Common issues include incorrect port or network configurations.
- Ensure the required Android SDK packages and system dependencies are correctly installed.
This project is licensed under the MIT License - see the LICENSE file for details.