Skip to content

Commit 00ccafe

Browse files
authored
feat: improve docker logs (#8)
* update readme
1 parent cee2824 commit 00ccafe

2 files changed

Lines changed: 69 additions & 8 deletions

File tree

README.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Access and control the Android emulator directly in your web browser with the in
3535
- [Using Web Interface](#use-the-web-interface-to-access-the-emulator)
3636
- [Using ADB](#connect-via-adb)
3737
- [Using Desktop scrcpy](#use-scrcpy-to-mirror-the-emulator-screen)
38+
- [First Boot Process](#-first-boot-process)
39+
- [Container Logs](#-container-logs)
3840
- [Roadmap](#-roadmap)
3941
- [Troubleshooting](#-troubleshooting)
4042
- [Contributing](#-contributing)
@@ -53,6 +55,7 @@ Access and control the Android emulator directly in your web browser with the in
5355
- **Docker Integration:** Easily deploy the Android emulator within a Docker container.
5456
- **Easy Setup:** Simple Docker commands to build and run the emulator.
5557
- **Supervisor Management:** Manages emulator processes with Supervisor for reliability.
58+
- **Unified Container Logs:** All emulator and boot logs are redirected to Docker's standard log system.
5659

5760
## 🛠️ **Prerequisites**
5861

@@ -131,6 +134,53 @@ scrcpy -s localhost:5555
131134

132135
> **Note:** Ensure `scrcpy` is installed on your host machine. [Installation Guide](https://github.com/Genymobile/scrcpy#installation)
133136
137+
## 🔄 **First Boot Process**
138+
139+
The first time you start the container, it will perform a comprehensive setup process that includes:
140+
141+
1. **AVD Creation:** Creates a new Android Virtual Device running Android 30 (Android 11)
142+
2. **Installing PICO GAPPS:** Adds essential Google services to the emulator
143+
3. **Rooting the Device:** Performs multiple reboots to:
144+
- Disable AVB verification
145+
- Remount system as writable
146+
- Install root access via the rootAVD script
147+
- Install PICO GAPPS components
148+
- Configure optimal device settings
149+
150+
> **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:
151+
> ```
152+
> Broadcast completed: result=0
153+
> Sucess !!
154+
> 2025-04-22 13:45:18,724 INFO exited: first-boot (exit status 0; expected)
155+
> ```
156+
157+
> **Note:** If the Android emulator has restarted for any reason, it's recommended to restart the Docker container to reapply optimizations:
158+
> ```bash
159+
> docker compose restart
160+
> ```
161+
> This ensures the following optimizations are applied:
162+
> - Disabled animations for better performance
163+
> - Screen timeout set to 15 seconds
164+
> - Disabled rotation
165+
> - Custom DNS settings
166+
> - Airplane mode enabled (with WiFi still active)
167+
> - Data connection disabled
168+
169+
After the first boot completes, a file marker is created to prevent running the initialization again on subsequent starts.
170+
171+
## 📋 **Container Logs**
172+
173+
All logs from the emulator and boot processes are redirected to Docker's standard log system. To view all container logs:
174+
175+
```bash
176+
docker logs -f dockerify-android
177+
```
178+
179+
This includes:
180+
- Supervisor logs
181+
- Android emulator stdout/stderr
182+
- First-boot process logs
183+
134184
## 🚧 **Roadmap**
135185

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

143194
## 🐞 **Troubleshooting**
144195

@@ -154,13 +205,19 @@ scrcpy -s localhost:5555
154205
docker logs dockerify-android
155206
```
156207

208+
- **First Boot Taking Too Long:**
209+
- This is normal, as the first boot process needs to perform several operations including:
210+
- Installing GAPPS
211+
- Rooting the device
212+
- Configuring system settings
213+
- The process can take 10-15 minutes depending on your system performance
214+
- You can monitor progress with `docker logs -f dockerify-android`
215+
157216
- **Emulator Not Starting:**
158-
- **Check Supervisor Logs:**
217+
- **Check Container Logs:**
159218

160219
```bash
161-
docker exec -it dockerify-android bash
162-
cat /var/log/supervisor/emulator.out.log
163-
cat /var/log/supervisor/emulator.err.log
220+
docker logs dockerify-android
164221
```
165222

166223
- **KVM Not Accessible:**

supervisord.conf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ serverurl=unix:///var/run/supervisor.sock
77

88
[program:emulator]
99
command=/bin/bash /root/start-emulator.sh
10-
stdout_logfile=/var/log/supervisor/emulator.out.log
11-
stderr_logfile=/var/log/supervisor/emulator.err.log
10+
stdout_logfile=/dev/stdout
11+
stdout_logfile_maxbytes=0
12+
stderr_logfile=/dev/stderr
13+
stderr_logfile_maxbytes=0
1214
autorestart=true
1315
startretries=3
1416
retry_interval=10
1517
priority=20
1618

1719
[program:first-boot]
1820
command=/root/first-boot.sh
19-
stdout_logfile=/var/log/supervisor/first-boot.out.log
20-
stderr_logfile=/var/log/supervisor/first-boot.err.log
21+
stdout_logfile=/dev/stdout
22+
stdout_logfile_maxbytes=0
23+
stderr_logfile=/dev/stderr
24+
stderr_logfile_maxbytes=0
2125
autorestart=false
2226
priority=10

0 commit comments

Comments
 (0)