How to dockerize Android Emulator and run it without any prerequisite softwares?

Software development Company

Downloading and installing the android emulators is a big headache as we have to download and set up tons of stuff manually like, JAVA, ANDROID TOOLS, etc. To avoid these manual steps there is a new technology that will solve your problem and rescue you from it.

Containers

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.

Docker

It used to be that when you wanted to run a web application, you bought a server, installed Linux, set up a LAMP stack, and ran the app. If your app got popular, you practiced good load balancing by setting up a second server to ensure the application wouldn't crash from too much traffic.

So by reading these 2 paragraphs you would become familiar with the words containers and docker right?

Let's Run The Emulator!

Now to run a container you first need a Docker Image, A docker image is just a file in which steps are written in it one by one and when we try to execute those steps it all executes in an isolated environment and becomes a container.

Google has an official Docker Script to run Android Emulators, so you don't need to write the images from scratch all by yourselves.

Requirements

Well yeah, I said you don't need to install any software, but you should at least have Docker and ADB installed for once. Docker for running images and ADB for detecting virtual devices by which you can use that emulator on your host device or can also access it remotely.

Run The Emulator Just by Terminal

Open a terminal and paste these codes.

carbon (2).png docker run
-e ADBKEY="$(cat ~/.android/adbkey)"
--device /dev/kvm
--publish 8554:8554/tcp
--publish 5555:5555/tcp
us-docker.pkg.dev/android-emulator-268719/images/30-google-x64:30.1.2

This will download the image and run it, you will not need to do any further steps.

After the container is ready, you can connect to your device just by typing this to terminal

carbon (1) (1).png

adb connect localhost:5555

After it you can see the available devices through ‘ADB Devices’ command

Final Words

Running an emulator on Linux has become easy as you just need to execute a simple one line of code and your device will automatically start the emulator. But keep in mind that this tutorial will only work on Linux devices in which KVM is enabled. In windows PC it won't work as no Nested KVM is available in it. Thank You!

Software development Company
Amir Alam

To run the emulator without the need of installing jdk, sdk, and other required drivers and software On Linux. Here is the tutorial to run any android emulator in a virtual environment using docker.

agile software development company

Contact Us

We’re looking forward to hear from you! Let’s make the next big product together.

Software Development Company in Aligarh

India

B3, HK Compound, NH 509, Sikandarpur, Chherat, Uttar Pradesh 202002

Phone +91-9045-708-272

Email: [email protected]

Software Development Company in UK

UK

16 Maryatt Avenue, London, U.K.

+44-7342-8931-85

[email protected]

Software Development Company in Riyadh

Riyadh

AlSulymaniah - Prince Mamdouh Street AlSafwa Building, Gate 1

+966-5959-6363-5

[email protected]

Sofyrus Technologies Company
Startup India
Good Firms
MicroSoft for Startup
ISO

© 2019-2023 Sofyrus Technologies | All Right Reserved |