-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cli-v2 issue with alpine using Docker #4971
Comments
I've been running into this as well - I copy in the bundle, unzip all the files, and I can see that In addition, this also seems to point to a bug where the installer can fail to actually install, but report success anyway, which is a problem. EDIT: FROM docker:stable
RUN apk add curl
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install -i /usr/local/aws -b /usr/local/bin/aws
RUN aws --version && docker -v I'm seeing output like:
Which exhibits the strange behavior where the installation seems to fail on line 78 of the installer, but the install script still seems to succeed, only then to have it fail when we try to actually run the installed bin. |
FYI Found same issues here: |
Hi @firstval, it looks like you found a response on this behavior in #4685. We're currently tracking Docker support in #3553 which would be a prerequisite for this to work. That said, we can definitely do better with the exceptions being returned. We're working on getting a warning in our install script to will alert you when the platform isn't supported. We'll track the remaining piece for alpine support in #3553. Thanks! |
Just to add my feddback, I have the exact same error about the aws file not existing, but it actually does, as |
I've got the same error: /bin/sh: aws: not found |
A comment that may not be relevant, but as Alpine uses a different runtime, musl, rather than glibc, could this be the issue? Essentially the binary file presented in the awscli v2 zip file is simply not compatible with Alpine? |
@rquadling That is exactly correct. They're looking to see if they can adapt to that, or at least make the errors more helpful, but that's the issue. |
I have the same issue. Would like to use the aws client to upload minified assets to S3 during build time. But using aws on Alpin is currently a pain in the ass. Version 1.X of aws doesn't support recursive uploads and version 2.0 of aws doesn't run correctly on Alpine. Would be nice if this would be fixed. |
I don't have a solution for Alpine, but I have got AWSCLI v2, Terraform, and JQ all off of Amazon Linux.
|
Why was this closed? Installation of awscli-v2 on Alpine is still failing. |
My understanding is that it was closed because Alpine isn't officially supported. There's some links to other issues further up in the thread about potentially adding it, or at least adding some sort of workaround. |
Just come across this : https://hub.docker.com/r/atlassian/pipelines-awscli |
Hello, I doubt it can work with CLI version 2. You have to use this kind of image, Alpine with |
I took a different route and installed the aws cli via |
Use https://git.adelielinux.org/adelie/gcompat
source: https://wiki.alpinelinux.org/wiki/Running_glibc_programs |
@AnthonyWC It doesn't work. |
(Care to elaborate as to why installing via |
@marcelloromani - the lone, working People in this thread are interested in |
Hi all, Please review the recently proposed source distribution for the AWS CLI v2 that has shown success (via third party) for building on Alpine Linux: There is also an example in the proposal for building on an Alpine Linux container image: https://github.com/kyleknap/aws-cli/blob/source-proposal/proposals/source-install.md#alpine-linux |
Damn, thanks @drewlustro I must have looked at this in haste. |
This worked for me :
|
this install aws cli v1 for me. |
Still up to date, the issue is from 2 years ago. Any intention to fix this? |
This container works for me (using For other container I just add:
|
I also had similar issue, when I gone through the AWS documentation, found I have to install following packages as a prerequisite: glibc, groff, and less groff and less both are available in Alpine Linux repo, but couldn't find glibc package. However I used musl and gcompat as an alternative (suggested here) which has fixed the issue. Now I can't see any errors during installation. RUN ./aws/install -i /usr/local/aws-cli -b /usr/bin Hope this might help others with awscliv2 installation in Alpine Linux. |
FROM alpine:edge |
@zeroc0d3 have you ran into this issue with alpine3.13+ ? have you fixed it somehow ? |
Feb 27, I realized that there is aws documentation for the cli v2 in alpine linux as mentioned in this issue 4685. |
Not working for me on
I'm on |
For Alpine linux this worked for me
|
It will install verion 1.X
|
Worked for me. I'm using php:8.26-fpm-alpine image. |
It is already possible to install I will put my comment that I made in another issue explaining: #4685 (comment) |
@thanks @wsalles . I just used apk 📦 |
we need improve this Dockerfile but works for me FROM alpine:3.17
ARG AWSCLI_VERSION=2.11.20
# set timezone America/Lima
ENV TZ=America/Lima
ENV TF_CLI_CONFIG_FILE=/home/terraformrc
ARG TERRAGRUNT_VERSION=latest
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN apk update && apk add --no-cache \
wget=1.21.4-r0 \
curl=8.1.2-r0 \
unzip=6.0-r13 \
bash=5.2.15-r0 \
jq=1.6-r2 \
gettext=0.21.1-r1 \
python3=3.10.12-r0 \
py3-pip=22.3.1-r1 \
#install jq
jo=1.9-r0 \
nodejs=18.16.1-r0 \
# nodejs \
npm=9.1.2-r0 \
#install yq
yq=4.30.4-r4 \
&& rm -rf /var/cache/apk/*
# Install Docker dependencies
RUN apk add --no-cache \
docker=20.10.24-r2 \
openrc=0.45.2-r7 \
&& rc-update add docker boot
#upgrade pip and set timezone
RUN pip install --no-cache-dir \
boto3==1.26.46 \
pyYAML==5.4.1 \
htmlmin==0.1.12 \
Jinja2==3.1.2 \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& curl -s https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_amd64.zip -o /tmp/terraform_1.4.6_linux_amd64.zip && \
unzip /tmp/terraform_1.4.6_linux_amd64.zip -d /tmp/ && \
chmod +x /tmp/terraform && mv /tmp/terraform /usr/bin/ && \
rm -rf /tmp/terraform_1.4.6_linux_amd64.zip && \
TERRAGRUNT_VERSION_INSTALL=$(curl -s https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest | grep tag_name | cut -d '"' -f 4) && \
curl -LO https://github.com/gruntwork-io/terragrunt/releases/download/"${TERRAGRUNT_VERSION_INSTALL}"/terragrunt_linux_amd64 && \
chmod +x terragrunt_linux_amd64 && \
mv terragrunt_linux_amd64 /usr/bin/terragrunt
#install awscli
#depencies for awscli v2
RUN apk add --no-cache \
git=2.38.5-r0 \
groff=1.22.4-r2 \
less=608-r1 \
mailcap=2.1.54-r0 \
build-base=0.5-r3 \
libffi-dev=3.4.4-r0 \
cmake=3.24.4-r0 \
openssl-dev=3.0.9-r1 \
python3-dev=3.10.12-r0
WORKDIR /tmp
RUN git clone --single-branch --depth 1 -b "${AWSCLI_VERSION}" https://github.com/aws/aws-cli.git && \
./aws-cli/configure --with-install-type=portable-exe --with-download-deps && \
make && \
make install && \
rm -rf /tmp/aws-cli \
&& rm -rf \
/usr/local/lib/aws-cli/aws_completer \
/usr/local/lib/aws-cli/awscli/data/ac.index \
/usr/local/lib/aws-cli/awscli/examples \
&& find /usr/local/lib/aws-cli/awscli/data -name "completions-1*.json" -delete && \
find /usr/local/lib/aws-cli/awscli/botocore/data -name examples-1.json -delete
WORKDIR /usr/local/lib/aws-cli
RUN for a in *.so*; do test -f "/lib/$a" && rm "$a"; done
ENTRYPOINT ["/usr/bin/terraform"]
|
Highly annoying that installing aws cli has become so complicated in v2. Not only this issue with Alpine but also the need to choose between right CPU architecture when you download the zip. I made this Gist incase it helps someone else https://gist.github.com/TeemuKoivisto/a99d51a2e4d86ebefad353ab2d4273ae |
@nielsbaltodanomatrix with a Dockerfile like that I cant help but wonder what the benefit is of using Alpine. I just did a test build and it seems like that container comes in around 1.4GB in size. At that point I would just use Ubuntu as the base image instead, and you would avoid the issue of compatibility with |
Hopefully it's old news by now but it's finally dead easy to install aws cli v2 on alpine.
Tested on Mac OS 14.0 |
@marcelloromani this is really great. awscli is in 3.18 branch . I can't wait for kubectl to move to the next stable branch. the image is really tiny and it works in arm64 |
For Anyone still facing this issue, use |
The error is still present for the image alpine:edge on architecture x86_64: Command runned : Docker Image : -> Package is not present for the architecture x86_64 : https://pkgs.alpinelinux.org/packages?name=aws-cli&branch=edge&repo=&arch=x86_64&maintainer=None (only for Arch) |
At this moment of writing, |
Thanks @gnought 🙏 currently build our - FROM alpine:latest
+ FROM alpine:3.19
RUN apk add --no-cache aws-cli
CMD ["/bin/sh"] ※ but we don't understand why now it's impossible to add use |
I guess the page is a bit outdated. Today I found that aws-cli v2 is now available in gnought:~ √ % docker run --rm -it --pull always alpine:3.20 sh
3.20: Pulling from library/alpine
Digest: sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd
Status: Image is up to date for alpine:3.20
/ # apk add aws-cli
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/aarch64/APKINDEX.tar.gz
(1/62) Installing libbz2 (1.0.8-r6)
(2/62) Installing libexpat (2.6.2-r0)
(3/62) Installing libffi (3.4.6-r0)
(4/62) Installing gdbm (1.23-r1)
(5/62) Installing xz-libs (5.6.1-r3)
(6/62) Installing libgcc (13.2.1_git20240309-r0)
(7/62) Installing libstdc++ (13.2.1_git20240309-r0)
(8/62) Installing mpdecimal (4.0.0-r0)
(9/62) Installing ncurses-terminfo-base (6.4_p20240420-r0)
(10/62) Installing libncursesw (6.4_p20240420-r0)
(11/62) Installing libpanelw (6.4_p20240420-r0)
(12/62) Installing readline (8.2.10-r0)
(13/62) Installing sqlite-libs (3.45.3-r1)
(14/62) Installing python3 (3.12.3-r1)
(15/62) Installing python3-pycache-pyc0 (3.12.3-r1)
(16/62) Installing pyc (3.12.3-r1)
(17/62) Installing py3-certifi (2024.2.2-r1)
(18/62) Installing py3-certifi-pyc (2024.2.2-r1)
(19/62) Installing py3-cparser (2.22-r1)
(20/62) Installing py3-cparser-pyc (2.22-r1)
(21/62) Installing py3-cffi (1.16.0-r1)
(22/62) Installing py3-cffi-pyc (1.16.0-r1)
(23/62) Installing py3-cryptography (42.0.7-r0)
(24/62) Installing py3-cryptography-pyc (42.0.7-r0)
(25/62) Installing py3-six (1.16.0-r9)
(26/62) Installing py3-six-pyc (1.16.0-r9)
(27/62) Installing py3-dateutil (2.9.0-r1)
(28/62) Installing py3-dateutil-pyc (2.9.0-r1)
(29/62) Installing py3-distro (1.9.0-r2)
(30/62) Installing py3-distro-pyc (1.9.0-r2)
(31/62) Installing py3-colorama (0.4.6-r5)
(32/62) Installing py3-colorama-pyc (0.4.6-r5)
(33/62) Installing py3-docutils (0.20.1-r2)
(34/62) Installing py3-docutils-pyc (0.20.1-r2)
(35/62) Installing py3-jmespath (1.0.1-r3)
(36/62) Installing py3-jmespath-pyc (1.0.1-r3)
(37/62) Installing py3-urllib3 (1.26.18-r1)
(38/62) Installing py3-urllib3-pyc (1.26.18-r1)
(39/62) Installing py3-wcwidth (0.2.13-r1)
(40/62) Installing py3-wcwidth-pyc (0.2.13-r1)
(41/62) Installing py3-prompt_toolkit (3.0.43-r1)
(42/62) Installing py3-prompt_toolkit-pyc (3.0.43-r1)
(43/62) Installing py3-ruamel.yaml.clib (0.2.8-r1)
(44/62) Installing py3-ruamel.yaml (0.17.28-r1)
(45/62) Installing py3-ruamel.yaml-pyc (0.17.28-r1)
(46/62) Installing aws-cli-pyc (2.15.57-r0)
(47/62) Installing py3-awscrt-pyc (0.20.3-r1)
(48/62) Installing python3-pyc (3.12.3-r1)
(49/62) Installing aws-c-common (0.9.19-r0)
(50/62) Installing aws-c-cal (0.6.14-r0)
(51/62) Installing aws-c-compression (0.2.18-r0)
(52/62) Installing s2n-tls (1.4.14-r0)
(53/62) Installing aws-c-io (0.14.8-r0)
(54/62) Installing aws-c-http (0.8.1-r0)
(55/62) Installing aws-c-sdkutils (0.1.16-r0)
(56/62) Installing aws-c-auth (0.7.22-r0)
(57/62) Installing aws-checksums (0.1.17-r1)
(58/62) Installing aws-c-event-stream (0.4.2-r0)
(59/62) Installing aws-c-mqtt (0.10.4-r0)
(60/62) Installing aws-c-s3 (0.5.9-r0)
(61/62) Installing py3-awscrt (0.20.3-r1)
(62/62) Installing aws-cli (2.15.57-r0)
Executing busybox-1.36.1-r28.trigger
OK: 189 MiB in 76 packages
/ # aws --version
aws-cli/2.15.57 Python/3.12.3 Linux/6.9.3-orbstack-00146-g1a8d02c90788 source/aarch64.alpine.3 |
I tried to install aws cli v2 with alpine using docker but after installation it doesn't find the aws command even the directories existing. I tried using the following commands
The text was updated successfully, but these errors were encountered: