pip3 not found エラーがでました
JenkinsでDocker Imageを作成する際に件のエラーが出た。
エラー詳細は下記のような感じ。
変更前のDockerfile
FROM alpine
RUN apk --update-cache add \
python3 \
python3-dev \
gcc \
g++ \
curl \
bash
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
RUN apk update \
&& apk upgrade \
&& gcloud components install kubectl
COPY ./requirements.txt /tmp/requirements.txt
RUN pip3 install --upgrade pip
RUN pip3 install -r /tmp/requirements.txt
- コンソールログ
pip3: not found
エラー
[0m ---> 1532f5abc8b7
Removing intermediate container 43dd3deb5a2a
Step 6/18 : COPY ./requirements.txt /tmp/requirements.txt
---> f670b2c8d83b
Step 7/18 : RUN pip3 install --upgrade pip
---> Running in eb003063baef
[91m/bin/sh: pip3: not found
[0mThe command '/bin/sh -c pip3 install --upgrade pip' returned a non-zero code: 127
Build step 'Execute shell' marked build as failure
Finished: FAILURE
解決策
py3-pip
を入れましょう
変更後のDockerfile
FROM alpine
RUN apk --update-cache add \
python3 \
python3-dev \
py3-pip \
gcc \
g++ \
curl \
bash
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
RUN apk update \
&& apk upgrade \
&& gcloud components install kubectl
COPY ./requirements.txt /tmp/requirements.txt
RUN pip3 install --upgrade pip
RUN pip3 install -r /tmp/requirements.txt
- コンソールログ
これで問題なく動く
[0m ---> eac6c5580f52
Removing intermediate container bb0aed0b3399
Step 6/18 : COPY ./requirements.txt /tmp/requirements.txt
---> 6950ee7fd4a5
Step 7/18 : RUN pip install --upgrade pip
---> Running in d21dcaf4353c
Requirement already up-to-date: pip in /usr/lib/python3.8/site-packages (20.1.1)
---> c5ac41af673c
Removing intermediate container d21dcaf4353c
Step 8/18 : RUN pip install -r /tmp/requirements.txt
---> Running in 327efdaa6d2a
Collecting google-cloud-bigquery
Downloading google_cloud_bigquery-1.25.0-py2.py3-none-any.whl (169 kB)
Collecting pandas