User_Targaryen
User_Targaryen

Reputation: 4225

How to install AWS CLI in docker container based on image “java:8”

I have a Dockerfile that is like:

FROM java:8

LABEL maintainer="CMS"


RUN apt-get install python-pip
RUN pip install awscli
....
.....

[Error: Unable to locate package python-pip]

My end goal is to have java8 and aws-cli installed. Also I don't want to use curl statements in the Dockerfile. Also I don't want to use the plain ubuntu image.

How should I go about doing it?

Upvotes: 0

Views: 5513

Answers (4)

this work for me: create dockerfile

FROM openjdk:8-alpine

RUN apk update;
RUN set -eux; \
        apk add python3 ; \
        pip3 --no-cache-dir install -U awscli; \
        pip3 install --upgrade pip;
RUN apk add groff

use docker build . -t aws then run: docker run -it aws /bin/sh

Upvotes: 0

Alexander Smirnov
Alexander Smirnov

Reputation: 155

If you want to base it on top of openjdk:8 image, try the following:

FROM openjdk:8

RUN set -eux; \
        apt-get update; \
        apt-get install -y --no-install-recommends \
            python3-setuptools \
            python3-pip \
        ; \
        rm -rf /var/lib/apt/lists/*

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

RUN apt-get clean

The other option is to use Alpine distribution:

FROM openjdk:8-alpine

RUN set -eux; \
        apk add python3 ; \
        pip3 --no-cache-dir install -U awscli

Sources:

Or you can get pre-builds from here:

Upvotes: 0

Al-waleed Shihadeh
Al-waleed Shihadeh

Reputation: 2855

try to update your docker file to

FROM java:8

LABEL maintainer="CMS"


RUN apt-get update && apt-get install -y \
    software-properties-common
RUN add-apt-repository universe
RUN apt-get update && apt-get install -y \
    python3.4 \
    python3-pip

RUN pip install awscli
....
.....

Upvotes: 0

Gokul Thiagarajan
Gokul Thiagarajan

Reputation: 830

The error says Pip is not installed. Try installing it properly. If installed try executing same commands to verify.

Upvotes: 1

Related Questions