简体   繁体   English

docker 镜像:openjdk:15:如何在其中安装 python

[英]docker image: openjdk:15: how to install python inside it

I want to create an image of openjdk15 and python我想创建一个 openjdk15 和 python 的图像

I am trying the Dockerfile for buid我正在尝试购买 Dockerfile

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

It seems that yum is not available on this image.似乎 yum 在此图像上不可用。 It uses microdnf as package manager.它使用microdnf作为 package 管理器。 Simply use following dockerfile to install python 3.6:只需使用以下 dockerfile 安装 python 3.6:

FROM    openjdk:15
RUN microdnf install python36

After building and running a container with shell process I received:在使用 shell 进程构建并运行容器后,我收到:

bash-4.4# python3 -V
Python 3.6.8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM