5

I'm just tinkering with my Android tablet and was wondering if I can get Docker running on it.

I've tried dkg install docker and also apt install docker both gave me unable to locate package Docker

I probably need to add Docker's repo into list of repositories. Have you ever done it ?

5
  • @Robert that's for running Termux inside Docker container. I'm trying to install Docker engine my Android tablet through Termux terminal.
    – wood
    Dec 24 '20 at 16:32
  • 1
    You can if your device is rooted and you build the kernel with required configurations including Linux namespaces, cgroups and capabilities. But phones don't have enough hardware resources. Also you cannot run Termux inside Docker. Termux isn't an OS, it's just an Android app. Dec 24 '20 at 17:24
  • @IrfanLatif what hardware resources would a phone not have? It's not like it uses virtualization. Docker runs fine on cheap servers with 512MB RAM, and even sub-$100 Android phones have that.
    – lights0123
    Dec 25 '20 at 2:38
  • @lights0123 it depends on what you want to run in Docker. A simple commandline program or an app definitely doesn't require much resources. But Android apps aren't designed to run in Docker. What I understand is that OP wants to run a Linux environment in Docker which surely won't run on a 512MB Android phone which is always running 100+ native daemons and Java apps. Personally, without using Docker, I've been running multiple Linux distros in containerized environment on my phone with customized kernel, even compiling programs. But in general phones aren't designed to be used in this way. Dec 25 '20 at 3:00
  • Docker is not virtualization, I already mentioned in my first comment. It uses LXC, mainly based on Linux kernel's namespaces, cgroups and capabilities. Docker just simplifies the use of LXCs. But you don't necessarily need Docker to make use of them. There are abundant tools available (like setpriv, capsh, firejail and so on) which you can use directly from commandline to containerize processes. And they work perfectly. But again, you cannot run Android apps this way. In fact Android apps are already containerized in the same sandboxes when they are forked by zygote. Dec 25 '20 at 3:10
5

March 2021: Possible with root & compiled kernel

From termux-root Issue #60 it appears that it is possible to use Docker without QEMU, but requires root & a custom kernel.

Details can be found in this gist

No, not possible

From: https://www.reddit.com/r/termux/comments/av6z2s/how_to_install_docker_on_termux/

contains a reply from a Termux dev:

This is not possible.

Docker requires features that are not available in typical kernel installed with Android OS. This is why docker is not packaged for Termux and likely never be - 99% of devices (even if rooted) won't be able to run it.

with the additional comment.

Termux does not emulate Linux. It just terminal application with own tools added to PATH.

2

I installed Docker on Termux. It was in the root -repo.

  1. pkg install root -repo
  2. apt install docker

I don't know if it works with every Android device. Mine is a Lenovo tablet TB-7304F.

0
1

Yes, possible
But indirectly through emulating the kernel with qemu.

We can use qemu to create an emulated kernel, as well as an emulated architecture (x86_64), on top of which we can run Docker and most modern containers and images (albeit slower).

You can find some instructions to do just this here.

0

in my case (htc u11) it was possible by running (as @Nuninoo said)

pkg install root-repo
pkg install docker

and if docker-compose is also needed it can be loaded via python

pkg install python3
pip3 install --upgrade pip
pip3 install docker-compose

(in my case that wont work since i have no rust-compiler installed (and i dont think there is one currently for aarch64-linux-android)

New contributor
hannes is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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