1
votes

I'm trying to write a dockerfile that will install Azure CLI so that I can run CLI commands in bitbucket pipelines.

However the installation of the CLI always fails:

E: Unable to locate package azure-cli The command '/bin/sh -c apt-get install azure-cli' returned a non-zero code: 100

Here is my 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

1 Answers

2
votes

you need to do apt-get update after importing new package feed to get packages from that feed.