Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Thumbs.db
.idea/

# Docker compose data
data/
data*/
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Access and control the Android emulator directly in your web browser with the in
- [Using Web Interface](#use-the-web-interface-to-access-the-emulator)
- [Using ADB](#connect-via-adb)
- [Using Desktop scrcpy](#use-scrcpy-to-mirror-the-emulator-screen)
- [Customizing Device Screen](#customizing-device-screen)
- [First Boot Process](#-first-boot-process)
- [Container Logs](#-container-logs)
- [Roadmap](#-roadmap)
Expand Down Expand Up @@ -134,6 +135,15 @@ scrcpy -s localhost:5555

> **Note:** Ensure `scrcpy` is installed on your host machine. [Installation Guide](https://github.com/Genymobile/scrcpy#installation)

### Customizing Device Screen

The emulator's display can be adjusted with environment variables:

- `SCREEN_RESOLUTION` (optional): sets the screen size in `WIDTHxHEIGHT` format.
- `SCREEN_DENSITY` (optional): overrides the device pixel density in DPI.

Configure these variables in your `docker-compose.yml` file (the provided example contains commented entries for reference). If `SCREEN_RESOLUTION` or `SCREEN_DENSITY` are omitted, the emulator uses its default settings.

## 🔄 **First Boot Process**

The first time you start the container, it will perform a comprehensive setup process that includes:
Expand Down
9 changes: 7 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
services:
dockerify-android:
container_name: dockerify-android
Expand All @@ -12,10 +13,14 @@ services:
environment:
- DNS=one.one.one.one
- RAM_SIZE=8192
# Optional screen resolution in WIDTHxHEIGHT format
#- SCREEN_RESOLUTION=720x720
# Optional screen density (dpi)
#- SCREEN_DENSITY=227
privileged: true
devices:
- /dev/kvm

scrcpy-web:
container_name: scrcpy-web
restart: unless-stopped
Expand All @@ -30,4 +35,4 @@ services:
sh -c "
adb connect dockerify-android:5555 &&
npm start
"
"
10 changes: 9 additions & 1 deletion start-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ if [ -f /data/.first-boot-done ]; then
RAMDISK="-ramdisk /data/android.avd/ramdisk.img"
fi

# Configure optional screen resolution and density
if [ -n "$SCREEN_RESOLUTION" ]; then
SCREEN_RESOLUTION_FLAG="-skin $SCREEN_RESOLUTION"
fi
if [ -n "$SCREEN_DENSITY" ]; then
SCREEN_DENSITY_FLAG="-dpi-device $SCREEN_DENSITY"
fi

# Start the emulator with the appropriate ramdisk.img
/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK -qemu -m ${RAM_SIZE:-4096}
/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $SCREEN_RESOLUTION_FLAG $SCREEN_DENSITY_FLAG $RAMDISK -qemu -m "${RAM_SIZE:-4096}"