Santhosh
Santhosh

Reputation: 11798

docker image: openjdk:15: how to install python inside it

I want to create an image of openjdk15 and python

I am trying the Dockerfile for buid

FROM    openjdk:15
RUN yum install -y oracle-epel-release-el7
RUN yum install -y python36

But when i try to build the image it shows

/bin/sh: yum: command not found
The command '/bin/sh -c yum install -y oracle-epel-release-el7' returned a non-zero code: 127

I checked the image also

$ docker run --rm -it --entrypoint ""  openjdk:15 sh -c "cat /etc/os-release"
NAME="Oracle Linux Server"
VERSION="8.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.3"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.3

Upvotes: 3

Views: 2277

Answers (1)

Michał Krzywański
Michał Krzywański

Reputation: 16910

It seems that yum is not available on this image. It uses microdnf as package manager. Simply use following dockerfile to install python 3.6 :

FROM    openjdk:15
RUN microdnf install python36

After building and running a container with shell process I received :

bash-4.4# python3 -V
Python 3.6.8

Upvotes: 7

Related Questions