如何在Docker中选择并下载Azure Bicep指定版本?
问题与解决方案
固定Bicep版本的下载方式
我之前在Docker镜像中,按照Azure官方文档的指引使用以下命令安装Bicep:
# Install Bicep RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 RUN chmod +x ./bicep RUN mv ./bicep /usr/local/bin/bicep
后来想要将Bicep版本固定为v0.23.1,尝试修改curl命令指定版本时一开始没成功,后续排查发现问题并非出在curl命令本身,而是PSRule的配置有误。
正确的指定版本下载命令
只需将原命令中的latest替换为目标版本号即可,具体命令如下:
# Install Bicep v0.23.1 RUN curl -Lo bicep https://github.com/Azure/bicep/releases/download/v0.23.1/bicep-linux-x64 RUN chmod +x ./bicep RUN mv ./bicep /usr/local/bin/bicep
正确的PSRule配置
以下是验证有效的ps-rule.yml配置内容:
requires: # Require PSRule for Azure v1.30.1 PSRule: '2.9.0' PSRule.Rules.Azure: '1.30.1'
内容的提问来源于stack exchange,提问作者DataBach
相关产品推荐
相关产品推荐

