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
65 changes: 61 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ 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)
- [First Boot Process](#-first-boot-process)
- [Container Logs](#-container-logs)
- [Roadmap](#-roadmap)
- [Troubleshooting](#-troubleshooting)
- [Contributing](#-contributing)
Expand All @@ -53,6 +55,7 @@ Access and control the Android emulator directly in your web browser with the in
- **Docker Integration:** Easily deploy the Android emulator within a Docker container.
- **Easy Setup:** Simple Docker commands to build and run the emulator.
- **Supervisor Management:** Manages emulator processes with Supervisor for reliability.
- **Unified Container Logs:** All emulator and boot logs are redirected to Docker's standard log system.

## 🛠️ **Prerequisites**

Expand Down Expand Up @@ -131,6 +134,53 @@ scrcpy -s localhost:5555

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

## 🔄 **First Boot Process**

The first time you start the container, it will perform a comprehensive setup process that includes:

1. **AVD Creation:** Creates a new Android Virtual Device running Android 30 (Android 11)
2. **Installing PICO GAPPS:** Adds essential Google services to the emulator
3. **Rooting the Device:** Performs multiple reboots to:
- Disable AVB verification
- Remount system as writable
- Install root access via the rootAVD script
- Install PICO GAPPS components
- Configure optimal device settings

> **Important:** The first boot can take 10-15 minutes to complete. You'll know the process is finished when you see the following log output:
> ```
> Broadcast completed: result=0
> Sucess !!
> 2025-04-22 13:45:18,724 INFO exited: first-boot (exit status 0; expected)
> ```

> **Note:** If the Android emulator has restarted for any reason, it's recommended to restart the Docker container to reapply optimizations:
> ```bash
> docker compose restart
> ```
> This ensures the following optimizations are applied:
> - Disabled animations for better performance
> - Screen timeout set to 15 seconds
> - Disabled rotation
> - Custom DNS settings
> - Airplane mode enabled (with WiFi still active)
> - Data connection disabled

After the first boot completes, a file marker is created to prevent running the initialization again on subsequent starts.

## 📋 **Container Logs**

All logs from the emulator and boot processes are redirected to Docker's standard log system. To view all container logs:

```bash
docker logs -f dockerify-android
```

This includes:
- Supervisor logs
- Android emulator stdout/stderr
- First-boot process logs

## 🚧 **Roadmap**

- [ ] Support for additional Android versions
Expand All @@ -139,6 +189,7 @@ scrcpy -s localhost:5555
- [x] Preinstall PICO GAPPS
- [x] Support Magisk
- [x] Adding web interface of [scrcpy](https://github.com/Shmayro/ws-scrcpy-docker)
- [x] Redirect all logs to container stdout/stderr

## 🐞 **Troubleshooting**

Expand All @@ -154,13 +205,19 @@ scrcpy -s localhost:5555
docker logs dockerify-android
```

- **First Boot Taking Too Long:**
- This is normal, as the first boot process needs to perform several operations including:
- Installing GAPPS
- Rooting the device
- Configuring system settings
- The process can take 10-15 minutes depending on your system performance
- You can monitor progress with `docker logs -f dockerify-android`

- **Emulator Not Starting:**
- **Check Supervisor Logs:**
- **Check Container Logs:**

```bash
docker exec -it dockerify-android bash
cat /var/log/supervisor/emulator.out.log
cat /var/log/supervisor/emulator.err.log
docker logs dockerify-android
```

- **KVM Not Accessible:**
Expand Down
12 changes: 8 additions & 4 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ serverurl=unix:///var/run/supervisor.sock

[program:emulator]
command=/bin/bash /root/start-emulator.sh
stdout_logfile=/var/log/supervisor/emulator.out.log
stderr_logfile=/var/log/supervisor/emulator.err.log
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
retry_interval=10
priority=20

[program:first-boot]
command=/root/first-boot.sh
stdout_logfile=/var/log/supervisor/first-boot.out.log
stderr_logfile=/var/log/supervisor/first-boot.err.log
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
priority=10