我需要在基于最新 python 映像(debian 10)的 docker 容器上安装 openjdk-8,但 openjdk-8-jdk 包已从稳定的 debian 存储库中删除。我已经尝试了常规方法,
apt-get install openjdk-8-jdk
但apt-cache search openjdk
只返回 openjdk-11。
答案1
这在 SO 上回答更好:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
答案2
我已设法通过手动下载软件包来解决这个问题获得:
RUN wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre-headless_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk-headless_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk_8u212-b03-2~deb9u1_amd64.deb
然后使用陣容与-i --force-all安装所有必需依赖项的选项:
RUN dpkg -i --force-all openjdk-8-jre-headless_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jre_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jdk-headless_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jdk_8u212-b03-2~deb9u1_amd64.deb
答案3
作为 Emil Chitas 答案的“插件”,使用获得:
- 检查德比安当前版本的网站(例如
8u275-b01-1~deb9u1
) - 下载前复制版本字符串并设置环境变量
- 开始下载
- 安装
下载方式:
VER=8u275-b01-1~deb9u1 \
ARCH=amd64 \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre-headless_${VER}_${ARCH}.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre_${VER}_${ARCH}.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk-headless_${VER}_${ARCH}.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk_${VER}_${ARCH}.deb
安装方式:
dpkg -i --force-all openjdk-8*