Use Docker to run the Android Fastboot tool.
-
Clone this repository:
git clone --recursive https://github.com/parallelqw/docker-fastboot.git cd docker-fastboot/
-
Build an image:
docker build -t fastboot .
-
Run fastboot. Replace
$subcommand
with the fastboot sub-command you want to run.docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot fastboot $subcommand
For example, to list connected devices:
docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot fastboot devices
You can leave out
$subcommand
to runfastboot help
:docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot fastboot
Passing
-v $PWD:/fastboot
maps the current directory to/fastboot
in the container, so you can access files in the current directory. Note the working directory is/fastboot
by default, so you can refer to files in the current directory using relative paths:docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot fastboot update ./update.img
If you run into problems, you can run a shell in the container with:
docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot --entrypoint /bin/bash fastboot
To run a root shell, add -u root
:
docker run --rm -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/fastboot --entrypoint /bin/bash -u root fastboot
For more information, see the Docker run reference.
This has only been tested on a Linux system. If you're using something like boot2docker, your USB devices might not be properly mapped.