Date created: Thursday, October 6, 2022 1:48:30 PM. Last modified: Sunday, April 6, 2025 11:41:13 AM

'adb' - Notes

Running adb in a Docker container with an Android device connected via USB (make sure adb isn't running on the host machine!):

$docker run -it --rm --privileged \
-v /dev/bus/usb:/dev/bus/usb \
-v ./:/android \
ubuntu:22.04

$ apt update -y && apt install -y --no-install-recommends android-tools-adb android-tools-fastboot

With a reusable container:

$ cat Dockerfile
FROM ubuntu:24.04

RUN apt update -y && \
apt install -y --no-install-recommends android-tools-adb ca-certificates curl libarchive-tools openssh-client

# Don't apt-get android-tools-fastboot, this is old in Ubuntu repo
RUN curl -O "https://dl.google.com/android/repository/platform-tools_r35.0.2-linux.zip" && \
echo 'acfdcccb123a8718c46c46c059b2f621140194e5ec1ac9d81715be3d6ab6cd0a platform-tools_r35.0.2-linux.zip' | sha256sum -c && \
bsdtar xvf platform-tools_r35.0.2-linux.zip && \
ln -s /platform-tools/fastboot /usr/local/bin/fastboot

RUN mkdir /android
WORKDIR /android


$ docker build . -t adb

$ docker run --rm -it --privileged -v /dev/bus/usb:/dev/bus/usb -v ./:/android adb

# Ensure fastboot version is >= 35.0.1
root@9deee6293349:/android# fastboot version 35.0.2-12147458
Installed as /platform-tools/fastboot

# Ensure fwupd > 1.9.10 is running:
root@9deee6293349:/android# apt-cache policy fwupd
fwupd:
Installed: (none)
Candidate: 1.9.28-0ubuntu1~24.04.1
Version table:
1.9.28-0ubuntu1~24.04.1 500
500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
1.9.16-1 500
500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages

adb commands:

$ adb devices
List of devices attached
XXXCCCVVVBBB    device

# If adb doesn't see the device try the following:
$ adb kill-server
$ adb start-server


$ fastboot devices
A209PXYX0202    fastboot

# If fastboot hasn't detected the device try something like the following, this fastboot should show the device

$ fastboot flashing unlock
(bootloader)     Device already : unlocked!
OKAY [  0.014s]
Finished. Total time: 0.014s

Previous page: Systap
Next page: Aliases