close

How to install awscli using pip in library/node Docker image

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to install awscli using pip in library/node Docker image in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to install awscli using pip in library/node Docker image?

  1. How to install awscli using pip in library/node Docker image?

    As you have correctly stated, pip installing on the docker image you are using is an older one not supporting --no-cache-dir.

  2. install awscli using pip in library/node Docker image

    As you have correctly stated, pip installing on the docker image you are using is an older one not supporting --no-cache-dir.

Method 1

Here’s the changes I needed to make this work:

  1. Change to python3 and pip3 everywhere.
  2. Add a statement to upgrade pip itself.
  3. Separate the awscli install in a separate RUN command.

Here’s a full repro that does seem to work:

FROM library/node:6.11.2

RUN apt-get update && \
    apt-get install -y \
        python3 \
        python3-pip \
        python3-setuptools \
        groff \
        less \
    && pip3 install --upgrade pip \
    && apt-get clean

RUN pip3 --no-cache-dir install --upgrade awscli

CMD ["/bin/bash"]

You can probably also keep the aws install in the same RUN layer if you add a shell command before the install that refreshes things after upgrading pip. Not sure how though.

Method 2

As you have correctly stated, pip installing on the docker image you are using is an older one not supporting --no-cache-dir. You can try updating that or you can also fix the second problem which is about missing python source headers. This can be fixed by installing python-dev package. Just add that to the list of packages installed in the Dockerfile:

FROM library/node:6.11.2

RUN apt-get update && \
    apt-get install -y \
        python \
        python-dev \
        python-pip \
        python-setuptools \
        groff \
        less \
    && pip install --upgrade awscli \
    && apt-get clean

CMD ["/bin/bash"]

You can then run aws which should be on your path.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read