m1 docker で awscli を使う

FROM hashicorp/terraform:0.12.21

RUN apk upgrade
RUN apk add curl unzip jq less git

RUN curl "" -o ""
RUN unzip
RUN ./aws/install
RUN rm

ENTRYPOINT [ "/bin/sh", "-c" ]
Step 6/8 : RUN ./aws/install
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in 915eb31d1af5
./aws/install: line 78: /aws/dist/aws: not found
You can now run: /usr/local/bin/aws --version
/bin/sh: aws: not found


install の中に色々入っているので、それをいじるのはめんどくさそう
aws の docker image が動くのか先に試してみる


terraform のほうを直接入れてみよう

FROM amazon/aws-cli

RUN yum install -y yum-utils
RUN yum-config-manager --add-repo
RUN yum -y install terraform

ENTRYPOINT [ "/bin/sh", "-c" ]
bash-4.2# yum install terraform
Loaded plugins: ovl, priorities [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.

 One of the configured repositories failed (Hashicorp Stable - aarch64),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=hashicorp ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable hashicorp
            subscription-manager repos --disable=hashicorp

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice

            yum-config-manager --save --setopt=hashicorp.skip_if_unavailable=true

failure: repodata/repomd.xml from hashicorp: [Errno 256] No more mirrors to try. [Errno 14] HTTPS Error 404 - Not Found

terraform と awscli って同時にないとだめなんだっけ…?


version: "3.7"
    image: hashicorp/terraform:0.12.21
    working_dir: /src
    entrypoint: ["/bin/sh", "-c"]
      AWS_DEFAULT_REGION: ap-northeast-1
      - .:/src


alias aws "docker run --rm -it -v ~/.aws:/root/.aws -v (pwd):/aws -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION amazon/aws-cli"