I am trying to install azure-cli
in a python
docker container but I get the following error:
[5/5] RUN pip3 install azure-cli:
#9 1.754 Collecting azure-cli
#9 1.956 Downloading azure_cli-2.43.0-py3-none-any.whl (4.3 MB)
#9 7.885 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 730.7 kB/s eta 0:00:00
#9 8.070 Collecting six>=1.10.0
#9 8.190 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
#9 8.227 Collecting azure-loganalytics~=0.1.0
. . .
#9 43.08 ERROR: Exception:
. . .
#9 43.08 raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
#9 43.08 File "/usr/local/lib/python3.7/contextlib.py", line 130, in exit
#9 43.08 self.gen.throw(type, value, traceback)
#9 43.08 File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 449, in _error_catcher
#9 43.08 raise SSLError(e)
#9 43.08 pip._vendor.urllib3.exceptions.SSLError: [SSL: KRB5_S_TKT_NYV] unexpected eof while reading (_ssl.c:2570)
#9 43.28 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#9 43.28 You should consider upgrading via the ‘/usr/local/bin/python -m pip install –upgrade pip’ command.
executor failed running [/bin/sh -c pip3 install azure-cli]: exit code: 2
And here’s my Dockerfile
FROM python:3.7-alpine
RUN apk add --update git bash curl unzip make coreutils openssh shadow
ARG TERRAFORM_VERSION="1.3.6"
ARG svgUserId=
ENV AZURE_DEFAULT_REGION=germanywestcentral
RUN if ! id $svgUserId; then
adduser svg -D &&
usermod -u ${svgUserId} svg;
fi
RUN curl https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip > terraform_${TERRAFORM_VERSION}_linux_amd64.zip &&
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /bin &&
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN pip3 install azure-cli
ENTRYPOINT []
Can someone help me find the issue?
2
Answers
Use below commands to install azure-cli in alpine image:
As you use Python alpine image, the first
RUN
command is redundant in your case.I’m running image python:3.11-slim and got away with the lines below.