简体   繁体   English

Docker:如何在 Debian jessie-slim 之上安装 OpenJDK JRE 12?

[英]Docker: How to install OpenJDK JRE 12 on top of Debian jessie-slim?

I am trying to install OpenJDK JRE 12 on top of debian:jessie-slim image.我正在尝试在debian:jessie-slim图像之上安装 OpenJDK JRE 12。

In the end, I need to install the openjdk-12-jre-headless package.最后,我需要安装openjdk-12-jre-headless包。 However, I am getting:但是,我得到:

E: The value 'openjdk-12-jre-headless' is invalid for APT::Default-Release as such a release is not available in the sources E: 'openjdk-12-jre-headless' 值对 APT::Default-Release 无效,因为源中没有这样的版本

I have tried different options, but it looks like I am doing something wrong.我尝试了不同的选择,但看起来我做错了什么。

My Dockerfile is quite complex, but the issue is reproducible with this one:我的 Dockerfile非常复杂,但是这个问题是可以重现的:

FROM debian:jessie-slim
RUN apt-get install -y --target-release openjdk-12-jre-headless

Okay I managed to install this jre distribution on image that you provided with given Dockerfile :好的,我设法在您提供给定 Dockerfile 的图像上安装了这个 jre 发行版:

FROM debian:jessie-slim
RUN apt-get update && \
 apt-get -y upgrade && \
 echo 'deb http://ftp.de.debian.org/debian sid main' >> '/etc/apt/sources.list' && \
 apt-get -y update && \
 mkdir -p /usr/share/man/man1 && \
 apt-get -y install openjdk-12-jre-headless

I had to add repository from here to /etc/apt/sources.list file.我必须从这里将存储库添加到/etc/apt/sources.list文件。 This is for amd64 jre distribution so if you want a different one just check the bottom of this page and add mirror for the version you want, like I did in my Dockerfile.这是用于 amd64 jre 发行版,因此如果您想要不同的发行版,只需检查此页面的底部并为您想要的版本添加镜像,就像我在 Dockerfile 中所做的那样。 Additionaly I had to create folder /usr/share/man/man1 because of this bug .另外,由于这个错误,我不得不创建文件夹/usr/share/man/man1

Finally I run the container with this image and checked java version :最后,我使用此图像运行容器并检查 java 版本:

openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment (build 12.0.1+12-Debian-1)
OpenJDK 64-Bit Server VM (build 12.0.1+12-Debian-1, mixed mode, sharing)

Hope this helps :)希望这可以帮助 :)

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

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