Installing aws cli using pip in Docker file


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 &&     python3 &&     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 /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
RUN rm -rf /run/nologin

RUN yum -y install mysql
RUN curl -O && \
    python3 && \
    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.


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

Answered By – Marcin

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published