-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to add support for running containers under Android (GOOS=android) #41111
Comments
OK, an update on this. I've just successfully made it happen: As I said, I don't agree that Android can't run Linux containers, so what I did was to replace every occurrence of I don't know how complex it would be to support Android OS the proper way, but this workaround proves that Android can indeed run Linux container, and more over, proves that docker works fine in Android. It would be amazing if you guys add an official support for this. |
Probably there could be a config for supported platforms, maybe some auto-detection like buildx does. /cc @tonistiigi |
any updates ? @cpuguy83 |
Absolutely needs to happen! |
Docker on android would be great |
I've just finished writing a step by step guide on how to get docker working on Android in this gist. After 7 months using it I can say that docker works pretty stable on Android. Again, with no VMs nor chroot. Docker runs pretty stable directly and purely on Android.
I'd like to hear from the Dev team @AkihiroSuda @cpuguy83 @thaJeztah @tonistiigi. Hear anything actually. Because after all this time this is still an issue in Limbo without any comments. I know that Docker is an important project, used by others very important projects and companies. Its stability is crucial and starting supporting a new operating system is an extremely delicated process. The changes introduced in the source code may crash other things not related with this that were perfectly working before. I understand that, because I'm also a dev. Besides, only few people around the world would be able to run it on their phones because of how much kernel modification it requires. But even a no, it's impossible to run docker on Android, you're the only guy on earth that managed it and it's not worth our time is appreciated than no answer whatsoever. |
I'd like to add to @FreddieOliveira comment that Docker for Android wouldn't run only on resource-limited phones. It could run on boards like Odroid N2+ where the OS would be Android - for the apps/user experience, but since the board is powerful and can run always-on, it could also run some docker containers to handle all sorts of non-android "server" apps (e.g. run Home Assistant). |
I've tested @FreddieOliveira guide also whether it works without termux. I've compiled it with little changes and generate Android system image with included binaries at /system/bin/ directory. It works perfect without any problems so far. No need termux app. Pretty solution when you've got Android source codes (AOSP) for your phone or dev board. |
Docker was added to Termux repo, that means it's not necessary to compile it manually anymore. You can install it by simply executing inside Termux:
And that's it! Note, however, that you still need a rooted phone with a modified kernel to successfully run docker on Android. |
Nevermind, see below. |
@alexanderadam I hope not. There would be nice to compile docker with official support for Android without @FreddieOliveira patches. |
Ah sorry, I misread this topic! |
I was thinking of experimenting with a little web server using Docker on a phone. So, +1 for this. |
This comment has been minimized.
This comment has been minimized.
If running containers on Android is possible, a very cheap old (not too old) phone can be a small server. It's very useful ! |
this is good and important |
+1 for this. |
please add support for android. (not too) old smartphones are definitely more economical than raspberry pi. (and some of the cheap old phones even have better hardware than raspberry pi) |
Support for Android would be amazing |
This could be amazing for reusing cell phones, I think we all have an Android lying around unused. |
Old android phones have more powerful hardware than something like raspberry pi, with built in UPS (the battery). Is much more efficient as well. Docker team should consider official support, open source community can take it forward after that. |
I reached to this post because I wanted my old phone act like a server. I wish the same, docker should be installed natively to Android. |
Given the hardware capabilities of today's smartphones it would be fantastic to be able to use docker on android without too much difficulty. it would open up a new world |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
+1 here as well |
+1 For any possibility. |
here from this gist: https://gist.github.com/FreddieOliveira/efe850df7ff3951cb62d74bd770dce27 which was led to from this reddit reply: https://www.reddit.com/r/termux/s/KiPKxsz55n Upvote for this🔺 |
@AkihiroSuda @cpuguy83 @thaJeztah @tonistiigi. Is this going to be planned? Is this at least being discussed? Please give updates, this would be so cool! |
|
I just created a feature request asking the Android kernel developers to add support for containers here. Please everyone consider upvoting it to give it more precedence: |
@AkihiroSuda Apparently the Android kernel doesn't have to support containers because it already supports whatever features are needed to implement them, if I understood it correctly. Disclaimer: I'm kinda lost here because I don't have any experience at all with kernel development. |
Regarding the first 2 points, since @FreddieOliveira created the patches, my understanding is that it would be his responsability to edit them to make them mergeable without breaking non-Android Linux due to the hard-coded paths like For the third point, see my previous comment. And for the last one, the whole point of using containerization is to avoid the extra resources VMs take. You can run containers in a VM, but they would run much faster without VMs. |
Disagree. See https://github.com/moby/moby/blob/master/contrib/check-config.sh for the needed configs. |
I've never submitted any pull request because I didn't know if it was a desired contribution, since no moby member ever commented on this. But now that I finally saw an interaction here from a member, I can review and rewrite the patches, if that's the case. About running docker inside a Linux VM, I've already tried that and by personal experience I can say that's extremely inefficient to the point it's more like a POC than a real usable thing. Whereas running it directly on Android is as efficient as running it on a computer. The Android kernel default configuration indeed misses a lot of necessary features and as we saw in the Google response, it will probably remain like that :/ So, even if the pull requests are accepted, running docker on Android will still require a custom kernel. And even if the features were enabled in the kernel, it's still necessary to have a rooted phone. |
Your very first reply was from a Moby member though 👀 🤔 (and labels being added by another member even before that: #41111 (comment)) |
Sorry to open an issue similar to dozens of others, but this one is not a duplicatedof any of those (yes, I check all of them to say that. In fact, I checked every single post throughout the whole internet about running docker in Android (or at least I think so)). Here's some considerations regarding this issue:
Even though I'm already able to run dockerd, containerd, runc, dockercli, tini and all other requirements, and here's the prove:
(this is docker running in my Redmi Note 7 in termux terminal emulator)
it doesn't serve of anything, since there's no container that supports the Android OS. This becomes clear when you try to
docker run
pretty much any container and all you get isno matching manifest for android/arm64 in the manifest list entries
error:Despite aarch64 is supported by the majority of containers, the Android OS is not. So, If you then try to run a Linux version of that container with the flag
--platform=linux/arm64
you'll get theoperating system is not supported
error:If you then patch docker source code to ignore this error and continue anyway (because like me, you don't agree that Android can't run Linux container), you'll finally get a segmentation fault:
So, my issue is, more specifically, about the containers starting to support Android or, more feasibly, docker starting to make Android support Linux containers.
The text was updated successfully, but these errors were encountered: