Issue
I'm trying to build an Alpine image containing the Android SDK - specifically, the platform-tools
package.
My Dockerfile does the following:
- Installs Java and sets
JAVA_HOME
(needed for Android). - Downloads the Android SDK tools from Google.
- Unzips the package.
- Sets
ANDROID_HOME
. Also setsPATH
so thesdkmanager
executable can be used. - Installs
platform-tools
usingsdkmanager
. - Adds
platform-tools
toPATH
.
platform-tools
contains an executable named adb
, but for some reason it cannot be seen. Running adb
returns:
bash: /android-sdk/platform-tools/adb: No such file or directory
Here is my Dockerfile:
FROM alpine:latest
# Install bash and java
RUN apk update
RUN apk add bash openjdk8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$PATH:$JAVA_HOME/bin"
# Download Android SDK and set PATH
RUN mkdir /android-sdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip *.zip -d /android-sdk && rm *.zip
ENV ANDROID_HOME="/android-sdk"
ENV PATH="$PATH:$ANDROID_HOME/tools/bin"
# Install platform-tools
RUN yes | sdkmanager "platform-tools"
ENV PATH="$PATH:$ANDROID_HOME/platform-tools"
RUN adb version # throws error: adb not found
I've looked at this question but the problem should be fixed with platform-tools v24.0 and higher.
Solution
Alpine uses musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements.
adb
is compiled with glibc
, so it won't be able to run in Alpine, which usually results in the error: No such file or directory
.
You can verify that a file is compiled with glibc
by running file <path to file> | grep "interpreter /lib64/ld-linux-x86-64.so.2"
.
Answered By - pierlo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.