Is it possible to run an android app in a docker container? The app should run a HTTP server, which should be accessible from other containers.
Joyce Babu
Joyce BabuJoyce Babu
Apr 04, 2018 How to build and run Android Emulator on a Docker container, run locally on MacBook. Assumption Docker is installed. I learned about Docker from this GitHub tutorial. In this tutorial, we will.
1 Answer
Why do you need an android app for running an HTTP server? Can't you just run apache or nginx inside the docker container?
If you want to run android apps on docker, you should look at this.https://registry.hub.docker.com/u/ksoichiro/android-emulator/
shauvikshauvik
Not the answer you're looking for? Browse other questions tagged androidvirtual-machinedocker or ask your own question.
I need to include existing android emulator with the changes included in it (qcow2 files) in the docker image.
Sequencing:
1) Create an emulator through the Android Studio
2) Run it with the
-writable-system
option3) Make the necessary changes (Xposed installation, some xposed modules, data recording on the SD card and so on). All of these changes writing to qcow2 files (system.img.qcow2, sdcard.img.qcow2, etc.)
4) Stop the emulator
5) Archive it
6) In the docker file:
7) In
xposed.ini
change absolute path to the emulator instanceWhen try to run the emulator inside the docker - the qcow2 files with changes are recreated instead of used existing. :(
I get the same android-sdk tools and emulator versions, the same JDK and so on.
Also trying to change paths in harware-qemu.ini to the new one (
/root/.android/avd/xposed/....
) but no luck.Some information about system and docker:
1) Android version 23 (6.0) x86 google_apis image
2) Run docker command:
3) Run android emulator command:
I really don`t know what to do. It is real, one time a have a luck, I get it and it was working great, but I lost this state and now nothing happens :(
By the way, in normal behavior I will get an error, like:
But now no errors, it just override my files :(
![Android Emulator Docker Image Android Emulator Docker Image](https://i0.wp.com/blog.mi.hdm-stuttgart.de/wp-content/uploads/2018/03/Pipeline.png?resize=656%2C168&ssl=1)
user2319786user2319786
1 Answer
I had the same problem when copying the emulator from the host to a docker container: the emulator inside docker would always start (in the best case) clean as after a factory reset, ignoring all my changes. This is how I solved the problem:
- I started the emulator inside the docker container and I installed everything I needed (Xposed, custom apks etc.) while the emulator was running in docker.
- After the emulator was setup the way I wanted, I turned if off and copied the
/root/.android/avd/<emulator name>
directory from the docker container to the host computer (by usingdocker cp
command). This way I obtained a backup copy of the emulator with all the custom settings that can be used with docker. - I built a new docker image containing all the sdk stuff and tools needed to run the emulator and I added to the image the
/root/.android/avd/<emulator name>
directory previously saved. Now when I start a docker container from the new image I have a working emulator with all the settings I need.
Bonus tip: if you want to use the snapshot feature of the emulator, you have to commit the changes in the container to a new image (see
docker commit
command) and then use that new image, simply copying the avd
directory will not work in this case and your snapshot will always be ignored.Claudiu GeorgiuClaudiu Georgiu