Android in docker solution with noVNC supported and video recording
Find a file
2017-04-12 14:25:12 +02:00
devices Enable Samsung Galaxy S6 2017-03-16 16:33:26 +01:00
example Updated README 2017-04-04 18:04:06 +02:00
images Simulation of SMS 2017-04-12 14:25:12 +02:00
src Simulation of SMS 2017-04-12 14:25:12 +02:00
.gitignore First commit 2016-12-22 14:29:57 +01:00
.travis.yml Moved to python 3 2017-03-27 12:45:21 +02:00
Dockerfile Simulation of SMS 2017-04-12 14:25:12 +02:00
LICENSE First commit 2016-12-22 14:29:57 +01:00
MAINTAINERS First commit 2016-12-22 14:29:57 +01:00
README.md Simulation of SMS 2017-04-12 14:25:12 +02:00
release.sh Using latest build-tool (25.0.2) 2017-03-28 12:31:14 +02:00
requirements.txt Enable preinstallation android packages 2017-03-24 16:49:07 +01:00
setup.cfg Refactored code, added log and emulator skins 2017-02-27 14:53:48 +01:00
supervisord.conf Simulation of SMS 2017-04-12 14:25:12 +02:00

Docker-Android

Build Status codecov

Android in docker solution with noVNC supported

Requirements

Docker is installed in your system.

Purpose

  1. Build android project / application and run unit test
  2. Run UI Test for mobile website with appium framework
  3. Run UI Test for mobile application with different frameworks (appium, espresso, etc.)
  4. Simulate Short Message Service (SMS)

Features

  1. Android emulator with different devices
  2. latest build-tool (version 25.0.2)
  3. noVNC to see what happen inside docker container
  4. Appium server and it is able to connect with selenium grid

List of Docker images

Supported OS Android version API level Image name Image status
Linux 5.0.1 21 butomo1989/docker-android-x86-5.0.1
Linux 5.1.1 22 butomo1989/docker-android-x86-5.1.1
Linux 6.0 23 butomo1989/docker-android-x86-6.0
Linux 7.0 24 TODO because still have a Bug
Linux 7.1.1 25 TODO because still have a Bug
OSX / Windows 5.0.1 21 butomo1989/docker-android-arm-5.0.1
OSX / Windows 5.1.1 22 butomo1989/docker-android-arm-5.1.1
OSX / Windows 6.0 23 butomo1989/docker-android-arm-6.0
OSX / Windows 7.0 24 TODO because still have a Bug
OSX / Windows 7.1.1 25 TODO because still have a Bug

Quick Start

  1. Enable Virtualization under System Setup in BIOS. (It is only for Ubuntu OS. If you use different OS, you can skip this step).

  2. Run docker-android

    docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=False --name android-container butomo1989/docker-android-x86-5.0.1
    

    Optional arguments

     -v <android_project_or_apk>:/root	: You need to share volume or apk file if for example you want to build the android project inside docker container or you want to run UI test by using appium.
     -e APPIUM=True: If you want to use appium as UI test framework to test mobile website or android application
    
  3. Verify the ip address of docker-machine.

    • For OSX, you can find out by using following command:

      docker-machine ip default
      
    • For different OS, localhost should work.

  4. Open http://docker-machine-ip-address:6080 from web browser.

Connect to Selenium Grid

This feature can be used only if you set APPIUM=True in environment variable.

Arguments

-e CONNECT_TO_GRID=True	: to connect appium server to your selenium grid.
-e APPIUM_HOST="<host_ip_address>": where / on which instance appium server is running. Default value: 127.0.0.1
-e APPIUM_PORT=<port_number>: which port appium server is running. Default port: 4723
-e SELENIUM_HOST="<host_ip_address>": where / on which instance selenium grid is running. Default value: 172.17.0.1
-e SELENIUM_PORT=<port_number>: which port selenium grid is running. default port: 4444

List of Devices

Type Device Name
Phone Samsung Galaxy S6
Phone Nexus 4
Phone Nexus 5
Phone Nexus 5x
Phone Nexus 6
Phone Nexus 6P
Phone Nexus One
Phone Nexus S
Tablet Pixel C
Tablet Nexus 7
Tablet Nexus 9
Tablet Nexus 10

Control android emulator outside container

adb connect <docker-machine-ip-address>:5555

Note: You need to have Android Debug Bridge (adb) installed in your host machine.

SMS Simulation

  1. Using telnet

    • Find the auth_token and copy it.
    docker exec -it android-container cat /root/.emulator_console_auth_token
    
    • Access emulator using telnet and login with auth_token
    telnet <docker-machine-ip-address> 5554
    
    • Login with given auth_token from 1.step
    auth <auth_token>
    
    • Send the sms
    sms send <phone_number> <message>
    
  2. Using adb

    docker exec -it android-container adb emu sms send <phone_number> <message>
    
  3. You can also integrate it inside project using adblib.

Troubleshooting

All logs inside container are stored under folder /var/log/supervisor. you can print out log file by using docker exec. Example:

docker exec -it android-container tail -f /var/log/supervisor/docker-appium.stdout.log