Awscli Version 2 On Alpine Linux


Answer :

Actually with a bit a effort it is possible to run AWS CLI v2 on Alpine:

FROM alpine:3.11  ENV GLIBC_VER=2.31-r0  # install glibc compatibility for alpine RUN apk --no-cache add \         binutils \         curl \     && curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \     && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \     && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \     && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk \     && apk add --no-cache \         glibc-${GLIBC_VER}.apk \         glibc-bin-${GLIBC_VER}.apk \         glibc-i18n-${GLIBC_VER}.apk \     && /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 \     && curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \     && unzip awscliv2.zip \     && aws/install \     && rm -rf \         awscliv2.zip \         aws \         /usr/local/aws-cli/v2/*/dist/aws_completer \         /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \         /usr/local/aws-cli/v2/*/dist/awscli/examples \         glibc-*.apk \     && apk --no-cache del \         binutils \         curl \     && rm -rf /var/cache/apk/* 

The above Dockerfile will install the 'glibc' package for Alpine, so that the AWS CLI will be able to find the required shared libraries. The Dockerfile also removes some stuff we probably don't need, such as auto-complete and examples. If you need some other specific packages you can of course add them to the Dockerfile.


AWS CLI version 2 is compiled against glibc, the GNU Project's implementation of the C standard library. Most common Linux distributions use glibc, but Alpine Linux is instead based on musl libc.

Because binaries compiled against glibc aren't compatible with musl, AWS CLI version 2 doesn't run on Alpine Linux.

The best way to run AWS CLI version 2 on Alpine Linux would be for Amazon to provide one of the following:

  • Binaries compiled against musl
  • A source distribution, which can be compiled on Alpine Linux
  • An official AWS CLI Docker image based on Alpine Linux

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?