sorccu/docker-adb

adb now available in Alpine Linux (edge/testing)

Opened this issue · 5 comments

FYI, there's now a android-tools package in Alpine edge which contains adb and fastboot only. It has been compiled natively for Alpine Linux so you don't need to rely on the glibc package anymore.

Here's the command I used to install it on an Alpine container:

RUN apk --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ add android-tools

This, and upgrading to Alpine 3.6, should help you reduce the container size even further.

That's interesting but I personally have a need for some of the other platform tools as well, though it might be fair to split those into a separate container, then.

Some other concerns:

  • I'm not entirely convinced that the alpine package won't become out of date, since they've essentially replaced the whole Android.mk system with a custom Makefile. This reminds me of the ubuntu package that was, and perhaps still is, literally years behind the official version.
  • When an adb client connects to a server, it runs a version check first. Should the version not match, the client will kill the server and attempt to start a new one. While it's certainly possible to have that version mismatch with the current image as well, I'm worried that it may become even more of an issue with the custom version - especially if any build-script breaking changes are introduced (see previous point). Unfortunately, people tend to use their host adb to connect to the adb server in the container instead of using the container adb for everything, so mismatching versions are a very real issue.

I'm willing to consider this if more people want it, but I think the space savings would be fairly minimal. I do agree that the current glibc hack is quite ugly, though.

This would actually have the benefit of supporting ARM as well.

It's true that the version which ships in Alpine is slightly outdated. I guess they take PRs to their aport repository but I'm not fluent with their package management system. Alternatively, I don't know how difficult it is to build stand-alone adb from the Android repository inside an Alpine container using multi-stage builds and publish that.

This whole issue is intended mainly as a FYI - I'm exploring the area and wanted to share some of the stuff I found, as they may be of interest to you.

Unfortunately it seems that the version on Alpine is already quite old. I'm not sure if I'd want to use that.

@qmfrederik, I'm trying to make a Hass.io addon (read: basically a Docker container) that will run the ADB server, but I'm a Docker rookie and I'm having some trouble. The base image is supposed to be Alpine Linux 3.6. If you're able to offer any help, I would really appreciate it!

Here was my initial attempt. I'm pretty sure I tried the snippet from your first post (although I didn't commit and push it), but it didn't work.

https://github.com/JeffLIrion/hassio-adb-server-addon/blob/ebf4a01f12f151d16abdb56c89e6d116db8f7f99/adb_server/Dockerfile

ARG BUILD_FROM
FROM $BUILD_FROM

ENV LANG C.UTF-8

# Install requirements for add-on
RUN apk add --no-cache adb jq

# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh

CMD [ "/run.sh" ]