在Dockerfile中安装Azure CLI找不到软件包azure-cli

时间:2018-12-07 16:18:22

标签: azure docker

我正在尝试编写一个将安装Azure CLI的dockerfile,以便可以在bitbucket管道中运行CLI命令。

但是CLI的安装总是会失败:

  

E:无法找到软件包azure-cli   命令'/ bin / sh -c apt-get install azure-cli'返回非零代码:100

这是我的dockerfile

FROM atlassian/default-image:latest

RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl

RUN apt-get update
RUN apt-get install -y libssl-dev libffi-dev
RUN apt-get install -y python-dev
RUN apt-get install apt-transport-https lsb-release software-properties-common -y

ENV AZ_REPO $(lsb_release -cs)
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | tee /etc/apt/sources.list.d/azure-cli.list

RUN apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv \
 --keyserver packages.microsoft.com \
 --recv-keys BC528686B50D79E339D3721CEB3E94ADBE1229CF

RUN apt-get install azure-cli

CMD ["/bin/bash"]

1 个答案:

答案 0 :(得分:3)

您需要在导入新的包供稿后执行apt-get update,以从该供稿中获取包。