
Pockr | Part 5 — Debugging the VM Restart Loop
A Race Condition in Kotlin Part 5 of 6 — building Pockr, a single APK that runs Docker on non-rooted Android. ← Part 4: Making Docker Run Without Kernel Modules The Symptom Alpine Linux takes ~5 minutes on first boot to set up Docker, install Python packages, and start the API server. During that time, the app shows a loading state. On real device testing (Firebase Test Lab), we kept seeing a cycle: VM starts → health check fails at ~35s → VM restarts → repeat Alpine was never given enough time to finish first-boot setup. Docker Hub pulls never happened. Reading the Logcat The logcat told the story: VmManager: Starting VM... VmManager: VM process launched VmApiClient: Health check failed: timeout ← 35s in VmManager: Starting VM... ← restarted! VmManager: Stopping existing VM before restart ← killed Alpine mid-boot VmManager: VM process launched VmApiClient: Health check failed: timeout ← again VmManager: Starting VM... ← restarted again The VM was restarting every ~35 seconds — exactly
Continue reading on Dev.to
Opens in a new tab


