Friday, 31 July 2015

Running Android apps in Docker using Googles ARC Welder

Firstly what is ARC Welder ?

It's a App runtime that allows you to run Android Apps in Chrome.  It is still in beta but looks really promising.  More details here : https://developer.chrome.com/apps/getstarted_arc

Installing the ARC Welder app is simple.  Just search the Chrome Webstore and add it to the browser.  Within minutes you can import a *.apk file for your favorite app and start playing about with it.  Cool.

There is a limitation though.  You can only load one Android app at a time.  Docker to the rescue. You can install Chrome and ARC Welder inside a container.  Each container can then be used for different Android Apps.

This may be handy for developers or QA folk who wish to run multiple versions of an app.

We also get the other benefits of Docker :

  1. Each app is isolated
  2. No modification needed on your host
  3. Easy to scale 
There are lots of ways to run Android apps for debugging purposes but this is the simplest I've come across.

To try this out you can run : 

docker run -it --net host --cpuset-cpus 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads --device /dev/snd --name arcwelder thshaw/arc-welder

You can easily start multiple arc-welder containers, one for each app  :

 docker run -it --net host --cpuset-cpus 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads --device /dev/snd --name instagram thshaw/arc-welder

docker run -it --net host --cpuset-cpus 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads --device /dev/snd --name evernote thshaw/arc-welder

docker run -it --net host --cpuset-cpus 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads --device /dev/snd --name angrybirds thshaw/arc-welder


More details can be found here : 

 

Docker Hub : https://registry.hub.docker.com/u/thshaw/arc-welder/

 

Github : https://github.com/tommyoshaw/arc-welder

 

Demo : Multiple Android Apps in containers
 

Demo : Angry Birds running on ARC Welder in Docker




10 comments:

  1. Can you publish the source (Dockerfile) for the thshaw/arc-welder docker image? TIA

    ReplyDelete
  2. Hi Viranch, I has issues getting the arc-welder installed automatically so I followed Jessica Frazelle chrome docker file and tried uploading arc-welder into the chrome image. In the end i gave up and manually installed and then commited the change. Here is the Dockerfile for reference :

    # Run Chrome in a container
    #
    # docker run -it \
    # --net host \ # may as well YOLO
    # --cpuset-cpus 0 \ # control the cpu
    # --memory 512mb \ # max memory it can use
    # -v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
    # -e DISPLAY=unix$DISPLAY \
    # -v $HOME/Downloads:/root/Downloads \
    # -v $HOME/.config/google-chrome/:/data \ # if you want to save state
    # --device /dev/snd \ # so we have sound
    # --name chrome \
    # jess/chrome
    #

    # Base docker image
    FROM debian:sid
    MAINTAINER Jessica Frazelle

    ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /src/google-talkplugin_current_amd64.deb

    ADD https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb /src/google-chrome-stable_current_amd64.deb

    # Install Chromium
    RUN mkdir -p /usr/share/icons/hicolor && \
    apt-get update && apt-get install -y \
    ca-certificates \
    gconf-service \
    hicolor-icon-theme \
    libappindicator1 \
    libasound2 \
    libcanberra-gtk-module \
    libcurl3 \
    libexif-dev \
    libgconf-2-4 \
    libgl1-mesa-dri \
    libgl1-mesa-glx \
    libnspr4 \
    libnss3 \
    libpango1.0-0 \
    libv4l-0 \
    libxss1 \
    libxtst6 \
    wget \
    xdg-utils \
    --no-install-recommends && \
    dpkg -i '/src/google-chrome-stable_current_amd64.deb' && \
    dpkg -i '/src/google-talkplugin_current_amd64.deb' \
    && rm -rf /var/lib/apt/lists/*

    COPY local.conf /etc/fonts/local.conf
    ADD arc.tar /data/Default/Extensions/
    ADD arc_dep.tar /data/Default/Extensions/

    # Autorun chrome
    ENTRYPOINT [ "/usr/bin/google-chrome" ]
    #CMD [ "--user-data-dir=/data", "--app-id=emfinbmielocnlhgmfkkmkngdoccbadn" ]
    #CMD [ "--user-data-dir=/data", "--load-extension=/data/Default/Extensions/emfinbmielocnlhgmfkkmkngdoccbadn" ]
    CMD [ "--user-data-dir=/data", "--load-extension=/data/Default/Extensions/mfaihdlpglflfgpfjcifdjdjcckigekc" ]
    #CMD [ "--user-data-dir=/data" ]

    ReplyDelete
    Replies
    1. Ah cool thanks, I understand the problem.

      Delete
  3. You and your friend both will get Rs.5 which can be redeem to your paytm wallet as cash. download mx player pro apk for free

    ReplyDelete
  4. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..

    Mobile App Development Company in Chennai
    Web Design Company in Chennai
    Web development Company in Chennai

    ReplyDelete
  5. Thanks for sharing such informative post, keep updating.
    Click here to know more about our services.
    Web Design company in Hubli | web designing in Hubli | SEO company in Hubli

    ReplyDelete
  6. Thank you for sharing such great information.arc welderIt is informative, can you help me in finding out more detail on Silicone Braided Hose,i am interested and would like to know more about this field and wanted to understand the basics of Silicone Tubing.

    ReplyDelete
  7. Graceful written content on this blog is really useful for everyone same as I got to know. Difficult to locate relevant and useful informative blog as I found this one to get more knowledge but this is really a nice one.apk downloader

    ReplyDelete