高山linux上的awscli版本2 [英] awscli version 2 on alpine linux

查看:110
本文介绍了高山linux上的awscli版本2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将 awscli_v2 放入基于阿尔卑斯的docker容器中,并看到它失败并显示以下错误消息:

I was trying to put awscli_v2 into an alpine-based docker container and see that it fails with the following error message:

/aws/install:第78行:/aws/dist/aws:找不到

/aws/install: line 78: /aws/dist/aws: not found

考虑到文件本身存在并且可以用ls列出,我猜想可执行文件./aws/dist/aws所依赖的某些库在高山上不存在.有人知道可能是哪个库吗?

Considering that the file itself is there and can be listed with ls, I would guess that some libraries that the executable ./aws/dist/aws relies upon are not present on alpine. Does someone know which libraries that might be?

推荐答案

实际上,只要稍作努力,就可以在Alpine上运行AWS CLI v2:

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 \
    && apk add --no-cache \
        glibc-${GLIBC_VER}.apk \
        glibc-bin-${GLIBC_VER}.apk \
    && 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 \
    && apk --no-cache del \
        binutils \
        curl \
    && rm glibc-${GLIBC_VER}.apk \
    && rm glibc-bin-${GLIBC_VER}.apk \
    && rm -rf /var/cache/apk/*

以上Dockerfile将为Alpine安装'glibc'软件包,以便AWS CLI能够找到所需的共享库. Dockerfile还删除了一些我们可能不需要的东西,例如自动完成和示例.如果您需要其他一些特定的软件包,您当然可以将它们添加到Dockerfile中.

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.

这篇关于高山linux上的awscli版本2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆