Live data from Hacker News

Android in Docker without QEMU/emulator

github.com

31–40 of 72 posts

Re: Android in Docker without QEMU/emulator

#31
post #21

This could be useful for running WhatsApp inside a vm instead of your phone for those rare instances where it is needed.

What do you mean? Where is it needed?

i believe they are referring to the whatsapp bug that the saudi prince used on jeff bezos. simply sending bezos a message gave the saudi prince root access on his phone and he dumped all his messages and photos and released them to the press. running in a vm would just have whatsapp so they can send and receive messages without exposing all the private information on their phone in case of some 0day

Re: Android in Docker without QEMU/emulator

#34
post #28

required params (already added in docker image) qemu=1 How is that without qemu?

Yeah not reading anywhere in the docs that it works without qemu. Also the need for kennel modules to be available on the host and passed through makes it less portable than most containers.

Re: Android in Docker without QEMU/emulator

#35
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…

Consider taking a moment to look into the difference between "emulator" and "virtual machine".

What the link refers to is an kind of Android emulator, but not the virtual machine kind of emulator.

If you are tempted to write a rebuttal in the "reply" box, answer this question first: Why are programs like xterm and urxvt called "Terminal Emulator"? What do they emulate?

Re: Android in Docker without QEMU/emulator

#36
This is interesting, but I don’t see this as something for use in development of Android apps. Given all Android’s quarks and fragmentation the use of real devices and Google’s emulators will provide a better surface to catch bugs during dev. What’s the primary use case for these containerized versions of Android?

Re: Android in Docker without QEMU/emulator

#37
post #21

This could be useful for running WhatsApp inside a vm instead of your phone for those rare instances where it is needed.

Frankly I just install Island, and then run Whatsapp (and all not-always-needed apps) inside it. Plus bonus: you can freeze the apps you don't need and keep the island running.

TIL about the Island app. Thank you!

Re: Android in Docker without QEMU/emulator

#38
post #28

required params (already added in docker image) qemu=1 How is that without qemu?

It's just a parameter to let the Android OS know that it's running in an emulated environment as opposed to running natively on a physical device.

For example, the GPU stack has to be somehow emulated using a custom OpenGL driver (in this case `mesa3d`). There's software emulation (swiftshader) and host GPU mode (GLES).

For performance reasons when using the host GPU, the GLES commands from the guest have to be serialized and sent over a kernel pipe to the QEMU and to the host OS. The commands are deserialized on the host and executed on the physical host GPU through the Shader Translator library (taken from the Google ANGLE project). The Google's QEMU fork (aka Android Emulator) usually loads this library and then takes care of proper rendering, such that users can see the rendering output of the emulated OS properly inside the emulator window on the host machine. You can do the same for the docker, otherwise you'd have to implement some other trick to share the GPU. `virtio-gpu` is a Linux kernel facility that is meant to replace QEMU pipe in the future.

The high-level details of this OpenGL emulation mechanism are described here: https://android.googlesource.com/platform/external/qemu/+/ma...

You can find the implementation of the QEMU OpenGL pipe mechanism here: https://cs.android.com/android/platform/superproject/+/maste...

Re: Android in Docker without QEMU/emulator

#39
post #34
post #28

required params (already added in docker image) qemu=1 How is that without qemu?

Yeah not reading anywhere in the docs that it works without qemu. Also the need for kennel modules to be available on the host and passed through makes it less portable than most containers.

Those kernel modules (`ashmem` and `hwbinder`) are standard when building the Linux kernel for Android and they are already part of the upstream Linux kernel tree [1][2]. Because this solution uses containers (which share the same kernel with the host OS), these additional modules are needed.

From the ReDroid kernel modules readme:

>Custom Kernel

>If use custom kernel (5.0+), you can enable binderfs and ashmem configs; So the kernel modules in this repo are not needed any more.

https://github.com/remote-android/redroid-modules#custom-ker...

More info here on Android-specific kernel modules here:

https://elinux.org/Android_Kernel_Features#List_of_kernel_fe...

[1] ashmem

https://github.com/torvalds/linux/blob/master/drivers/stagin...

[2] hwbinder

https://github.com/torvalds/linux/tree/master/drivers/androi...

Re: Android in Docker without QEMU/emulator

#40
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.

I personally haven't managed to get anbox to run at either acceptable performance or any kind of level I would consider stable. Someone posted waydroid as an alternative here a few months ago, but I haven't tried it yet.
Post reply on HN