Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I am trying to install java 8 on base image of Ubuntu in a docker container.
I am running the following command,
RUN apt-get update && \
apt-get install -y software-properties-common python-software-properties && \
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" && \
apt-get update && \
echo "$accept-license" | sudo debconf-set-selections && \
apt-get install --allow-unauthenticated -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/oracle-jdk8-installer
On running the above command I am getting the following error,
Connecting to download.oracle.com (download.oracle.com)|23.57.66.26|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-20 06:29:41 ERROR 404: Not Found.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
Thank you,
Farhan
As of this morning, the Webupd8 Oracle-java8-installer is successfully downloading and installing in docker for me. The links in the PPA installer must have been updated. Yay!
My Dockerfile that was failing at the end of last week but now works
FROM ubuntu:14.04
USER root
RUN apt-get update
RUN apt-get -y install default-jre
RUN apt-get install -y software-properties-common python-software-properties
RUN apt-get -y -q update && \
apt-get -y -q upgrade && \
apt-get -y -q install software-properties-common htop && \
add-apt-repository ppa:webupd8team/java && \
apt-get -y -q update && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
apt-get -y -q install oracle-java8-installer && \
update-java-alternatives -s java-8-oracle
Related
I am totally newbie to Docker. My task is to create such environment to be able to work Spring Boot app on in and what's more I want to have also Heroku CLI installed also (I perform operations between databases on two different accounts using heroku:pg copy). What's more its size should be as small as it is possible and reach max 500MB (would be best if even less) that is quota for Heroku account
Here is my Dockerfile:
FROM ubuntu
# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean;
# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Install sudo
RUN apt-get update && \
apt-get -y install sudo
# Add user and switch to it
RUN useradd -m login && echo "login:password" | chpasswd && adduser login sudo
USER login
# Install curl and use curl
RUN echo "password" | sudo -S apt --assume-yes install curl
RUN echo "password" | sudo -S curl https://cli-assets.heroku.com/install.sh -o ~/heroku.sh
# Run Heroku script
RUN echo "password" | sudo -S sh ~/heroku.sh
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
# Add an app and listen on port
ADD target/project-server-1.0-SNAPSHOT.jar .
COPY project-91878452-firebase-adminsdk-dxv9z-0db48a2d01.json /
EXPOSE 8000
CMD java -jar project-server-1.0-SNAPSHOT.jar
This code works, I tested that locally but on Heroku there is an error on start saying that size has been considerably exceeded.
So what should I change in Dockerfile to make image size based on this Dockerfile as small as it is possibke and meet the requirements mentioned at the beginning of the post?
Kind regards!
Below is my Dockerfile
FROM python:3.8-slim-buster
WORKDIR /app
RUN python --version
RUN apt-get install java-1.8.0-openjdk-devel
RUN python -m pip install --upgrade pip
RUN pip install --default-timeout=100 pyspark
I want to install java 8 and set JAVA_HOME variables. But when I am trying to build above image I am getting below error:
E: Unable to locate package java-1.8.0-openjdk-devel
E: Couldn't find any package by glob 'java-1.8.0-openjdk-devel'
E: Couldn't find any package by regex 'java-1.8.0-openjdk-devel'
This is my first attempt in creating a docker image. Please suggest what is wrong with above Dockerfile. I am working on centos7.
Another approach is that you can build your Dockerfile based on FROM ubuntu:20.04 where Python 3.8 is set as default (here). Then, install java and pip later.
FROM ubuntu:20.04
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get install openjdk-8-jdk -y \
&& apt-get install python3-pip -y \
&& export JAVA_HOME \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
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
I am trying to install java 8 through oracle-java8-installer on a debian:jessie docker container. The following is my Dockerfile:
FROM debian:jessie
ENV JAVA_VERSION 1.8.0
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | /usr/bin/debconf-set-selections
RUN apt-get update
RUN apt-get install -y --force-yes vim
RUN apt-get install -y --force-yes oracle-java8-installer
Yet this gives:
Connecting to download.oracle.com (download.oracle.com)|23.63.224.171|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-17 12:31:05 ERROR 404: Not Found.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get install -y --force-yes oracle-java8-installer' returned a non-zero code: 100
I have found many similar issues described online, but none of the proposed solutions worked for me. Any idea?
Found the solution on https://hub.docker.com/r/anapsix/docker-oracle-java8/~/dockerfile/:
## JAVA INSTALLATION
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends oracle-java8-installer && apt-get clean all
The "secret sauce" you were looking for is the first line:
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Re to donhector's response and your question: you need to replace the strings in the installer file, instead of yours last command:
apt-get install -y --force-yes oracle-java8-installer
run these commands:
apt-get -y install oracle-java8-installer || true
cd /var/lib/dpkg/info
sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' oracle-java8-installer.*
sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.*
sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.*
sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.*
apt-get install -f -y
apt-get install -y oracle-java8-set-default
I have them in a separate script and run it as
RUN /bin/sh /path/to/script.sh
or you can run them directly from your Dockerfile, that's up to you.
You are installing from the webupd8 PPA repo. If you notice, the Java 8 package in that repo points to Java 8 version 151. That package pulls the binary for 151 from the Oracle servers (since Java Oracle licence does not allow anyone else hosting the binaries). Oracle released version 161 a couple days back and apparently moved or removed 151 from their servers. So basically the package in the webupd8 PPA repo is trying to download the 151 binary which no longer exists at the location that the webupd8 package expects it (hence the 404 you got). The webupd8 PPA repo maintainer will have to release a new package pointing to the new 161 binaries from Oracle. Docker or Debian don't play any role in the issue, it is just basically a broken link issue.
Until then you could apply a "workaround" like the one mentioned here: JDK 8 is NOT installed - ERROR 404: Not Found
Here's the list of Java packages in the webupd8 repo:
https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages
See dpkg oracle Jdk error while installing cassandra in Ubuntu 16.04. This issue is occurring for everyone using install scripts of any kind.
** Java 11:
RUN apt-get install wget java-common gnupg2 -y
RUN echo "oracle-java11-installer shared/accepted-oracle-license-v1-2 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /etc/apt/sources.list.d/linuxuprising-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends oracle-java11-installer && apt-get clean all
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I'm trying to install java 8 in my Ubuntu 16.4 using Docker file but I get the below error -
Connecting to download.oracle.com (download.oracle.com)|65.202.184.96|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-19 15:34:18 ERROR 404: Not Found.
Dockerfile
FROM ubuntu:16.04
ENV GOSU_VERSION 1.9
ENV SPARK_VERSION 2.0.2
ENV SPARK_HOME /usr/local/spark
ENV SPARK_USER aml
ENV GLIBC_APKVER 2.24-r0
ENV LANG=en_US.UTF-8
LABEL vendor=ActionML \
version_tags="[\"1.6\",\"1.6.3\"]"
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN apt-get update && \
apt-get dist-upgrade -y
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
FYI- As of this morning, the Webupd8 Oracle-java8-installer is successfully downloading and installing in docker for me. The links in the PPA installer must have been updated. Yay!
As root, go to this folder: /etc/apt/sources.list.d
Locate this file: webupd8team-java.list and delete it.
Execute sudo apt-get update for the system to remove any reference to that update server.
Execute add-apt-repository ppa:webupd8team/java to add the correct ppa to your system.
Execute sudo apt-get update again and you should be able to install everything correctly.