46

I’m a mobile developer and recently adept at using containers with docker. I’m developing a container architecture for my graduate project. One of the modules of this architecture would need to be run on an android device. But I could not find information on how to run a container on an android device. It could be something simple like an alpine image with python.

Can anyone tell me if there is a possibility to run a container on an android device with docker, or even kubernetes?

2
  • 1
    I also tried to install docker on an android. There has been ARM64 docker from Debian which can be easily installed. However, on my device, docker service failed to start because of issues of cgroups. It seems that android system is using cgroups by itself (source.android.com/devices/tech/perf/cgroups), and I don't know how to (if possible) make docker work without breaking the android system.
    – user14714234
    Nov 26, 2020 at 17:03
  • related question on android subsite: android.stackexchange.com/questions/232264/…
    – btwiuse
    Mar 27, 2021 at 5:04

5 Answers 5

20

In 2021, the answer is definitely yes.

Here is a tutorial on that topic, which shows you how to run docker directly on Android, without VMs nor chroot. Note that you do need to root your phone and build a custom kernel though.

If you only want a quick look of docker running on android without getting your hands dirty, check out this comment on GitHub.

1
  • Unfortunately it requires a recompiled kernel. With that much work involved, avoiding chroot seems strange at least. Feb 8 at 6:56
14

It is possible to use it for running docker on an android device using an application like termux or userland to install a qemu package.

The best way is to use alpine linux terminal, an android app available on github.

This alpine term app has a QEMU to run like alpine ISO. All things are automated and this works with x86_64 kernel on any android.

Some android phones have a KVM kernel so this device can run faster alpine term

Also my friends made a video on a YouTube channel to run docker on any android phone without root.

1
  • 3
    Video is private.
    – Dentrax
    Aug 13, 2022 at 13:25
7

I must note that I am not an expert in Android development. But I researched on this topic, and @Emile's answer is the easiest and closest you can get - as it seems.

You can actually run Fedora (and not only) image on top of the Termux and then launch Python inside. This is obviously not a docker, but might be helpful.You can find more info here.

In addition, I've found this topic on Quora which is a similar question:

Think about it: Docker abstracts the OS and that is all. The Android OS is quite a different kernel than linux distributions, even though it is linux. It might be tricky to get applications meant for a linux distribution to run on Android/Docker.

One of the main reasons to use docker is that it can provide self-contained packages of applications which do not affect the rest of the system. The Android applications, packaged as .apk files are just that.

Other than that I was able to find this topic on StackOverflow which does not really resolve the issue. As the issue might be related to AUFS and some Kernel features needed by LXT which are not present in Android - now some of them is from what I remember.

Also there is a claim that it is possible on docker forum and weibo (use translation to English), but there is only a screenshot provided by user and no details on how to do it, besides "it took a lot of effort" statement. So it would seam that this is still a not well known part, or maybe someone will be able to actually provide more complementary information - maybe try on Docker forum or GitHub.

1
  • 1
    I understood what you meant. Actually I did not need very sophisticated features, but just instantiate a module from my middleware and process some data by running a python script. If I process this data in a container pre-established by me, my architecture would be a bit more standardized and simple. I also opened a discussion in the docker forum. I'll investigate the suggestions you've given me. Thank you very much. Nov 30, 2018 at 14:50
5

We open the Android container, which can run the docker container on the Android operating system. Not only can run Docker containers, but also other containers, such as podman. In addition, we have also enabled the container to support checkpoint and restore functions, and support the migration of containers across architectures and operating systems. See https://github.com/CGCL-codes/Android-Container for details.

1

Some people think it's impossible but it isn't you can run a full ubuntu on your phone by this android app https://play.google.com/store/apps/details?id=com.termux You can even install gui envrioment and connect over vnc everything is supported in this so also docker or website hosting and so on (Make sure you follow al install steps in the app https://play.google.com/store/apps/details?id=studio.com.techriz.andronix to install linuxes like arch or ubuntu fedora or more you have to install these it doesn't work by just opening termux) YOU DON'T HAVE TO ROOT TO USE THIS METHOD

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.