skip to Main Content

I am getting this error while trying to install aws cli from pip.

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:

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. can someone help me with this. Any suggestions will be highly appreciated.

2

Answers


  1. I seems you don’t have python3 nor python3-pip in your image. 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
    
    Login or Signup to reply.
  2. Instead of installing Python3, I recommend using Python2.7 and updating the URL.(This is for learning purpose not for production environment)

    You can refer updated URL using below-attached artifact,

    RUN curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py && 
    python get-pip.py && 
    pip install awscli --upgrade
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search