Live data from Hacker News

Android in Docker without QEMU/emulator

github.com

1–10 of 72 posts

Re: Android in Docker without QEMU/emulator

#2
Came across this very useful project. It provides Docker images with Android running directly in Docker, without qemu or an emulator. I've never seen this before, all other solutions that I'm aware of either run the Android emulator in Docker or use qemu directly (like Anbox).

Advantage of this is that it's very lightweight and does not require VT-X or AMD-V, ideal for running in cloud environments that typically do not expose this CPU capability.

Re: Android in Docker without QEMU/emulator

#5
post #3

Interesting concept but seems to require custom android-specific kernel modules (ashmem, binderfs), which means the android containers aren't very containerized but leak into the host kernel.

The Docker container also needs to be run in privileged mode, so you should probably treat this as if it were an emulator running root. It does work around dependencies on VT-x and such, though, and cuts down on the performance overhead of virtualising an extra kernel.

Re: Android in Docker without QEMU/emulator

#7
post #2

Came across this very useful project. It provides Docker images with Android running directly in Docker, without qemu or an emulator. I've never seen this before, all other solutions that I'm aware of either run the Android emulator in Docker or use qemu directly (like Anbox). Advantage of this is that it's very lightweight and does not require VT-X or AMD-V, ideal for running in cloud environments that typically do…

Anbox doesn't use QEMU. It uses the same underlying kernel tech as Docker, LXC and other isolation tech. This is why you need the ashmem and "binder"(?) kernel modules to run Anbox.

I'm currently "trying" to get Anbox working on NixOS (It's currently broken on 5.x kernels but should be fixed by https://github.com/NixOS/nixpkgs/pull/102341) so that's why I know that Anbox is the "same" as this.

Re: Android in Docker without QEMU/emulator

#8
post #3

Interesting concept but seems to require custom android-specific kernel modules (ashmem, binderfs), which means the android containers aren't very containerized but leak into the host kernel.

All Linux containers leak the host kernel no?

The Anbox project relies on the exact same 2 modules: https://docs.anbox.io/userguide/install_kernel_modules.html. While these are "android-specific", they are present in the linux kernel tree, and even come pre-installed in Ubuntu 19.04 (and probably more distros).

Re: Android in Docker without QEMU/emulator

#9
post #2

Came across this very useful project. It provides Docker images with Android running directly in Docker, without qemu or an emulator. I've never seen this before, all other solutions that I'm aware of either run the Android emulator in Docker or use qemu directly (like Anbox). Advantage of this is that it's very lightweight and does not require VT-X or AMD-V, ideal for running in cloud environments that typically do…

Anbox and Waydroid are others, though they don't use Docker.

https://github.com/anbox/anbox (https://news.ycombinator.com/item?id=24684187)

https://github.com/waydroid/waydroid (https://news.ycombinator.com/item?id=28616985)

Re: Android in Docker without QEMU/emulator

#10
post #5
post #3

Interesting concept but seems to require custom android-specific kernel modules (ashmem, binderfs), which means the android containers aren't very containerized but leak into the host kernel.

The Docker container also needs to be run in privileged mode, so you should probably treat this as if it were an emulator running root. It does work around dependencies on VT-x and such, though, and cuts down on the performance overhead of virtualising an extra kernel.

Or try running it with podman.
Post reply on HN