简体   繁体   中英

Error in JDK installation in ubuntu docker

I have a docker file like below.

FROM ubuntu
FROM python:3.6

RUN apt-get update --fix-missing
RUN apt-get install wget curl software-properties-common -y
RUN apt-get install g++ gcc mercurial -y


RUN apt-get update && \
    apt-get install -y openjdk-8-jdk && \
    apt-get install -y ant && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /var/cache/oracle-jdk8-installer;

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME

When i try to build the docker using sudo docker build -t test_dock. command, there is an error saying

Unable to locate jdk package

So i have added

RUN add-apt-repository ppa:openjdk-r/ppa

before jdk installation command. Now the build errors out saying

E: The repository ' http://ppa.launchpad.net/openjdk-r/ppa/ubuntu focal Release' does not have a Release file.

What is the correct way to install jdk in ubuntu docker?

For me solved by replacing:

FROM ubuntu
FROM python:3.6

To:

FROM python:3-stretch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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