Is it possible to run containers on android devices? - android

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?

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.

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.

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.

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.

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

Related

Can you build React Native apps (Android app) on Ubuntu?

As I can see here you need OS X to build apps with React Native. That is probably because they used it at first to create only iOS apps. Now it's possible to create Android apps with React Native but they still require OS X as development platform which doesn't make sense to me. Is there any way to create Android apps using React Native on Ubuntu OS or any other Linux?
Update 2: I've been developing React native apps on Ubuntu for some time now, without any issues.
Update 1: It's almost possible on linux and windows now. Check this doc page: link
Old answer:
It's already almost working, from the issue shared in kzzzf's answer:
Everything works on Linux except:
react-native run-android can't open a new shell window, you need to
use react-native start. Will be fixed in next release. Debugging in
Chrome currently relies on an AppleScript to launch Chrome. There's a
PR to replace that.
Building on linux and windows is not officially supported although there are people in the community already sending pull requests that will allow to do so (main obstacle is the fact of using apple-script and calling to shell scripts from node - from react-packager and from react-cli).
Main task for tracking those efforts is here: https://github.com/facebook/react-native/issues/2693
While it's not officially supported on Linux yet, and there are certainly some hoops to jump through, I have created a docker container that allows me to build and run android apps from Ubuntu.
The dockerfile is still a work in progress but it's available on github: https://github.com/gilesp/docker/tree/master/react_native
There's a couple of shell scripts to make local development easier - I mainly use the react-bash script to give me a shell prompt in the container for running react-native run-android etc.
It works well enough that I can have a phone connected via USB on my host machine, the react native stuff running in the container and have my edits to the code (I mainly edit using emacs on the host) appear immediately on the device.
I'm currently working on CI builds for android as there are some more hoops to jump through to create the bundled version of the javascript for deployment.
It should be possible by now. For an up to date guide on "can i build for platform X on system Y", see:
https://facebook.github.io/react-native/docs/getting-started.html

Is it possible to run java application on android through openjdk

Disambiguation first: question is not about developing or compiling with openjdk code that would be run on dalvik in production. It is about using oracle runtime on android environment.
I'm using java for running small desktop utility application. I have no experience in Android and iOS development and I'm curious to which extent my classic java skills may be transferred to the mobile field.
I've googled couple of methods for running java application on iOS embedding runtime inside the application package. Android has its own partially incompatible and slow java virtual machine. It still is better than nothing, but I'm curious if it is possible to run application on genuine hotspot(openjdk) virtual machine. Android as well as iOS have the ability to run native code. May this ability be exploited to use third-party (non dalvik) jre on android?
I'm not interested on google play market so restrictions from it, if there are any, may not be taken into account.
Rooting is also possible since I'm going to write tools for myself. I would prefer methods that would be easy for installing. Like putting some package files and editing couple of options. And not build my own android distribution like CyanogenMod.
Without rooting the device, I don't think there is a way to do it.
Apparently, see http://openjdk.java.net/projects/mobile/android.html
The instructions are slightly out of date, I managed to do some hacking and get it to build though. Not sure if it runs yet

Develop for Android on both Linux and Windows machines at the same time

I've currently got two computers. One computer is at home another one is where I work.
On my breaks I like to work on my own projects at work, however my machine at work is Linux.
My machine at home is Windows.
I'd like to know if it is possible to simultaneously work on an Android Java project
on both Windows and Linux?
Clearly I could easily use mercurial or dropbox and just put my work there, but this is not what I'm asking.
What I'm asking is, what IDE can I use that works in both linux and windows, will compile the same way so I won't have to change the code based on what operating system I'm using to compile, will let me achieve this goal?
==SUMMARY==
Will Eclipse work the exact same way as it does in Linux (Linux Mint 16 to be exact), as it does in Windows? Will I be able to save a project in Linux from Eclipse, and open it up when I get home in Windows and continue working on it?
Using Eclipse on Windows and Linux will definitely work 'the same way' no matter what. The Eclipse versions are identical, they produce the same results. You'll be fine.
As you already mentioned, it would be useful to use some version control system to share the code between the two machines, but you can share the code any way you want.
Yes, you can use both Eclipse and Intellij (preferred one) in both linux and windows without any additional requirements and problems.

Build Android app to run in JRE

I have seen questions and topics in google referencing running JRE apps in the android environment, but I am actually thinking about the reverse.
I understand Android runs on a different runtime engine than the standard JRE.
Is it possible to build an app to run on android, but also build and run the same app in the JRE on a desktop?
I assume there would be restrictions on API usage, I was just thinking about the possibility to distribute a simple app that could be useful on both the device and the desktop.
I think the bigger problem here is going to be accessing the Android API and environment on your desktop. Do you have a plan for that?
If you have the Android environment running on your desktop then there shouldn't be any problem running your app there.
This answer offers an alternative suggestion.
Short answer: your desktop and Android app can share a large portion of code, but you aren't going to be able to run Android-specific code on the desktop.

Can I run Wine on an Android slate?

I would like to run a small Windows program on an Android slate. It runs just fine under Wine in Ubuntu, but I am unsure how to install & run Wine on the Android slate.
Sorry if it's not strictly a programming question. If you want it to be so, I could rephrase it as "will I have to write my Delphi code again Java in order to run it on an Android slate?"
but I am unsure how to install & run Wine on the Android slate.
I sincerely doubt that is possible or will be within the next decade. While Android runs a Linux kernel, most of what WINE depends upon in Linux will look very different on Android. Not to mention the opcode issue noted by JOTN.
"will I have to write my Delphi code again Java in order to run it on an Android slate?"
Most likely. I don't know what "my Delphi code" entails. If it is pure algorithm stuff, conceivably you could use Free Pascal to get an ARM library you could link to via the Android NDK. If, however, "my Delphi code" involves the UI and the like, you would have to rewrite it (or cook up your own Delphi->Android translator) to get it to use Android's widget library.
I don't believe it will work because you would be trying to run x86 software on a non-x86 processor. To start you would need binaries compiled for an ARM processor.
If your windows program has any GUI, then it will definitely not work. Wine relies on an X-windows system when Android has its own graphical framework...
I've been looking at something similar recently. Wine doesn't run on anything that is not x86, period. When you introduce a GUI (as noted by Matthieu), anything outside of wine will need to utilise another graphics libraries.
It might be worth mentioning wine-lib, you can use this with gcc to cross complile to ARM but you'll end up in a 'world of pain' as soon as you have a GUI. I cannot be 100% but my guess is you're in for a rewrite. http://wiki.winehq.org/ARM
If you do go for a rewrite perhaps look at other languages as Java for android is not nessarliy the same Java you'll run on your desktop. http://www.oreillynet.com/onjava/blog/2007/11/dalvik_googles_tweaked_nonstan.html
I know it's a bit of a 'fad' but you might be best looking at html5/webapp or using c/c++ and gtk/qt if you can find work-arounds.
You can, but it is not easy and possibly too slow. The experimental process is described here: http://forum.xda-developers.com/showthread.php?t=1258506
It is a multi-step process. First you get an Ubuntu system image and chroot into that. Then from there you can invoke wine to display on the local vncserver. Then you install a vncviewer app on android to view the GUI.
Your android device would need to have an x86 CPU. So far, only netbooks will work for this as I don't believe there are any tablets available with x86 and Android compatability. I would only recommend going this route for fun and experimentation -- not productivity.

Categories

Resources