简体   繁体   English

在 Docker 文件中使用 pip 安装 aws cli

[英]Installing aws cli using pip in Docker file

I am getting this error while trying to install aws cli from pip.尝试从 pip 安装 aws cli 时出现此错误。

ERROR: Service 'remote_host' failed to build: The command '/bin/sh -c curl -O https://bootstrap.pypa.io/get-pip.py &&     python3 get-pip.py &&     pip3 install awscli --upgrade' returned a non-zero code: 127

Docker File : Docker 文件

FROM centos
RUN yum -y install openssh-server
RUN useradd remote_user && \
    echo remote_user:1234 | chpasswd && \
    mkdir /home/remote_user/.ssh && \
    chmod 700 /home/remote_user/.ssh
COPY remote-key.pub /home/remote_user/.ssh/authorized_keys
RUN chown remote_user:remote_user -R /home/remote_user/.ssh && \
    chmod 600 /home/remote_user/.ssh/authorized_keys
RUN /usr/bin/ssh-keygen -A
EXPOSE 22
RUN rm -rf /run/nologin

RUN yum -y install mysql
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
    python3 get-pip.py && \
    pip3 install awscli --upgrade
 
CMD /usr/sbin/sshd -D

Issue This is my Docker file and I'm getting error by this.问题这是我的 Docker 文件,我收到错误消息。 can someone help me with this.有人可以帮我弄这个吗。 Any suggestions will be highly appreciated.任何建议将不胜感激。

I seems you don't have python3 nor python3-pip in your image.我似乎你的图像中没有python3python3-pip You can rectify the issue by installing it.您可以通过安装来解决问题。

Instead of:代替:

RUN yum -y install mysql

you can write:你可以写:

RUN yum -y install mysql python3 python3-pip

Instead of installing Python3, I recommend using Python2.7 and updating the URL.我建议不要安装 Python3,而是使用 Python2.7 并更新 URL。

You can refer updated URL using below-attached artifact,您可以使用下面附加的工件参考更新的 URL,

RUN curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py && \
python get-pip.py && \
pip install awscli --upgrade

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM