简体   繁体   English

如何使用 apk 在高山容器中安装 terraform 0.12?

[英]How to install terraform 0.12 in an alpine container with apk?

I want to add terraform version 0.12.21 in an alpine container, but I can only add 0.11.0 using apk .我想在 alpine 容器中添加terraform版本0.12.21 ,但我只能使用apk添加0.11.0 If I try to add it as the desired version I get the following error:如果我尝试将其添加为所需版本,则会出现以下错误:

/ # apk upgrade terraform==0.12.21-r0
OK: 192 MiB in 66 packages
/ # apk add terraform==0.12.21-r0
ERROR: unsatisfiable constraints:
  terraform-0.11.0-r0:
    breaks: world[terraform=0.12.21-r0]

How do I fix this apk error?如何修复此 apk 错误?

I havent found an apk solution but I can just download the desired binary and replace the existing one with the following in the dockerfile:我还没有找到apk解决方案,但我可以下载所需的二进制文件并将现有的二进制文件替换为 dockerfile 中的以下内容:

# upgrade terraform to 0.12.21
RUN wget https://releases.hashicorp.com/terraform/0.12.21/terraform_0.12.21_linux_amd64.zip
RUN unzip terraform_0.12.21_linux_amd64.zip && rm terraform_0.12.21_linux_amd64.zip
RUN mv terraform /usr/bin/terraform

I'm documenting @SantaXL's comment as an answer just to make it easier to find in the future.我将@SantaXL 的评论记录为答案,只是为了将来更容易找到它。

apk add terraform --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community

This doesn't specifically add version 0.12, as per the question.根据问题,这并没有专门添加版本 0.12。 Instead, it installs the latest version of terraform held in the Alpine repository.相反,它会安装 Alpine 存储库中保存的最新版本 terraform。 Note that this isn't necessarily the latest version of terraform, but it usually is.请注意,这不一定是 terraform 的最新版本,但通常是最新版本。

For example:例如:

apk add terraform --repository=http://dl-cdn.alpinelinux.org/alpine/v3.12/main

where 3.12 is apk's branch其中3.12是 apk 的分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM