So, You decided to develop in Docker containers. π³
Thatβs a good choice because it solves a lot of problems. ππΌ
On the other hand, it adds new ones. π
Great, We, developers, love to solve problems. ππΌπ§πΌβπ»
In the video below, I show you how to connect your Android phone, via ADB, to your Linux machine.
No worries, itβs easy as pie.
Follow the steps described in the video below, and you should be able to interact with your android phone from your Docker Container on a Linux Host.
If you are more a reading person, just follow the steps below.
First you have to have VSCode installed as we are going to develop in a Docker Container using VSCode and the Remote Container extension.
Everything youβre doing here is done on a Linux host machine. The steps are different on MacOS or Windows.
I did all of it on an Ubuntu machine, so tell me if you tested it on another distro and it worked (or not).
You have to describe the Dockerfile you are going to use to develop in a Docker Container.
Here is the one I used in the video :
# Pull Ubuntu LTS image.
FROM shostarson/base-dev-env:v1
# Labels and Credits
LABEL \
name=βAdb on Linux Hostβ \
author=βRΓ©mi Lavedrine <remi@github.com>β \
maintainer=βRΓ©mi Lavedrine <remi@github.com>β \
description=βAdb in Docker Container on a Linux Host machine.β
ENV SRC_DIR=/root/home/adb-linux
WORKDIR $SRC_DIR
COPY . .
RUN apt update -y && apt install -y β no-install-recommends android-tools-adb
And the .devcontainer.json file that describes the configuration for this container on VSCode.
You just have to add these args to the file :
βrunArgsβ: [ β β privilegedβ,
β-vβ,
β/dev/bus/usb:/dev/bus/usbβ ],
Rebuild everything in the Container and you are good to go.
Try adb devices on your Container with your Android phone connected to your host machine. You should see your device as an authorized one.
Tip :
Donβt forget that an Android phone can be connected to only one ADB server at a given time. So if itβs not working get sure that an ADB server is not running on your host machine.
If so, kill it and retry in your Docker Container.
I hope you enjoyed it and that it helps you to use Docker and Containers at their maximum possibilities.
If you like this content, push the like button, that helps spread the message. ππΌ
If you think it can be useful to anyone in your network, share it. π¨
Video produced by Wild & Secure, your consulting firm to all things security and real estate.
If you want to receive weekly quality content about security, subscribe to our newsletter on our website.
Top comments (0)