I'm trying to install java on my docker to be able to use a node module (... yes ...)
I've been searching and I found multiple way of doing it but it always throw an error so, I'm gonna show you what I use for now
RUN apt-get update
RUN apt-get install -y --no-install-recommends software-properties-common
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
switching grom java 8 to java 11 throw the same error:
W: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu impish Release' does not have a Release file.
E: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/impish/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
If someone could help me understand what I'm missing that could be cool !
This is a way to stop the problem. The reason why I why trying to use this RUN add-apt-repository -y ppa:openjdk-r/ppa is because without I was getting this error
E: Sub-process /usr/bin/dpkg returned an error code (1)
But after some research I found this way of using java inside my docker:
RUN apt-get -y update
RUN mkdir -p /usr/share/man/man1/
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
The second line fixed the problem by creating the right folder
Related
im trying to install openjdk-8-jdk as suggested here with the command:
sudo apt-get install openjdk-8-jdk
but apt dosnt find the package. i did find it at packages.debian.org manualy and tried to tell apt to also load from there, as suggested on the mirrors page of that package by adding the following line to /etc/apt/sources.list
deb http://ftp.de.debian.org/debian sid main
but apt still cant find the package. i also tried to change the
url to http://deb.debian.org/debian
sid to buster or buster-backports
main to unstable, non-free, contrib (or a list of some or all of those)
combinations of all of the above
still no luck.
add the following line to /etc/apt/sources.list
deb http://deb.debian.org/debian/ sid main
install openjdk8
//Update the repositories
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk
In fact, I think it is better to search for your question first before ask.
How to install openjdk-8-jdk on Debian 10 (Buster)?
I currently have a docker container with an Ubuntu(17.10) image installed with other packages included. However, I'm currently having difficulty trying to install Java onto this container in addition to the current image.
Current Dockerfile :
FROM cityofzion/neo-privatenet
ADD files/ files/
ENTRYPOINT [ "/bin/bash" ]
When trying to find information on how to do this and testing inside of the container most suggest using this command: apt-get install -y oracle-java9-installer
However this results in:E: Unable to locate package oracle-java9-installer
I have also tried this suggested command wget http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz
Which produces this result HTTP request sent, awaiting response...
404 Not Found - ERROR 404: Not Found.
I have only tried running these commands in the container, since that is how they would be run and they seem to be failing.
Can anyone suggest what I can include into my Dockerfile that install java onto my image?
Thanks in advance.
You can also directly pull any of the open-jdk images mentioned at (https://hub.docker.com/_/openjdk/) and use it. There is no need to install Ubuntu in docker image and then install Java on top of it. These images already use Ubuntu (with bare-minimum file system).
add to to your docker file
RUN \
apt-get update && \
apt-get install -y software-properties-common && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java9-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
ENV JAVA_HOME /usr/lib/jvm/java-9-oracle
Following from here
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
Oracle JDK version 7
sudo apt-get install oracle-java7-installer
Oracle JDK version 8
sudo apt-get install oracle-java8-installer
The full story here is that I want to use AWS Codebuild to compile a Java10 + JavaFX app.
So I made a docker image from the open JDK. Here it is.
But looks like it doesn't include JavaFX.
So I installed that too by adding
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y openjfx
But still I'm getting errors when I try the build
error: module not found: javafx.controls
requires javafx.controls;
if I do java --list-modules javafx doesn't show..
Any pointers would be appreciated!
!!update!!
so i got a dockerfile to work.
FROM ubuntu:14.04.5
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository ppa:linuxuprising/java
RUN apt-get update
RUN apt-get install -y libx11-6
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | \
debconf-set-selections
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | \
debconf-set-selections
RUN apt-get install -y oracle-java10-installer
RUN apt-get update
RUN apt-get upgrade -y
so this has been running now for a while and seems ok... so i guess i can close the Q.
FROM ubuntu:14.04.5
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository ppa:linuxuprising/java
RUN apt-get update
RUN apt-get install -y libx11-6
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | \
debconf-set-selections
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | \
debconf-set-selections
RUN apt-get install -y oracle-java10-installer
RUN apt-get update
RUN apt-get upgrade -y
I'm trying to install java7 via ppa (RUN add-apt-repository ppa:webupd8team/java -y) in my docker image but it fails with this error:
returned a non-zero code: 127
The following are suggested ways to install correctly but it's not working. I've tried both ppas as well.
RUN apt-get install python-software-properties -y
RUN add-apt-repository ppa:webupd8team/java -y
#RUN add-apt-repository ppa:eugenesan/java -y
RUN apt-get update
RUN apt-get install oracle-java7-installer -y
Here is the log output:
Step 28 : RUN add-apt-repository ppa:webupd8team/java -y
---> Running in b278761a4209
[91m/bin/sh: 1: add-apt-repository: not found
[0m
So...I need to find out where/if this command exist in a helper lib or what:
add-apt-repository
add-apt-repository appears to be a part of the python-software-properties install. I don't see any real errors in that step except for these messages which pop up in other areas of the build. So I assume that if I can resolve this issue the aforementioned python step will install as needed:
[91mdebconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
[0m[91mdebconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
[0m[91mdpkg-preconfigure: unable to re-open stdin:
So. How to set a term or dialog up? I thought the -y allowed this
The -y in your apt-get install commands is telling apt-get to "assume yes", which isn't the same as running in non-interactive mode.
You're seeing the "unable to initialize frontend: Dialog" messages because Debian is running apt-get in interactive mode. To tell it to run in non-interactive mode, add this line to the start of your Dockerfile:
ENV DEBIAN_FRONTEND noninteractive
Now your commands will be running in non-interactive mode, so apt-get won't try and pop any dialogs up.
As for your actual error, you're right, add-apt-repository is a part of the python-software-properties. Try putting your apt-get update -y command above your apt-get install python-software-properties command.
RUN apt-get update -y && \
apt-get install python-software-properties -y && \
add-apt-repository ppa:webupd8team/java -y && \
apt-get update -y && \
apt-get install oracle-java7-installer -y && \
oracle-java7-set-default
Note, you'll need to do two apt-get update -y commands, one before you start (always a good habit to get into) and one after you've added the oracle java PPA.
apt-get manual
Docker ENV docs
add-apt-repository command is a part of software-properties-common pakage. Install software-properties-common, not python-software-properties.
Then you can add ppa:webupd8team repository. But there is still a problem.
Set the accepted-oracle-license-v1-1 and install java. Below sample Dockerfile will work perfectly.
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:webupd8team/java -y
RUN apt-get update
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN apt-get install oracle-java7-installer -y
Way #1
Somebody said this way not working but i tested it works.
ENV DEBIAN_FRONTEND noninteractive
yes | apt-get install package-1 package-2
Way #2
ENV DEBIAN_FRONTEND noninteractive
apt-get install -y package-1 package-2
I was trying to install java using the following command:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
during the installation for some reason my micro-instance in EC2 kept on freezing, I guess I am not the only one having this issue as it's posted on the aws forum as well. Now when I try to do the whole thing again I get:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
However, when I try to run sudo dpkg --configure -a, it is just stuck in here:
Setting up sun-java6-bin (6.26-1lucid1) ...
for about an hour or so... WHat should I do now to get java in place?
It could be that the repository you added doesn't have the 'right' version of java6, personally I would use canonical's repository.
First I would try to uninstall the packages and repo
sudo apt-get remove sun-java6-jre sun-java6-plugin sun-java6-fonts
sudo remove-apt-repository ppa:ferramroberto/java
And then use canonical's aptitude repository.
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
I thinks its the same Bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/634487
issue fix
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pd#admin:~$ sudo dpkg --configure -a
dpkg: error: parsing file '/var/lib/dpkg/updates/0024' near line 0: newline in field name `#padding'
pd#admin:~$ sudo rm /var/lib/dpkg/updates/0024
pd#admin:~$ sudo dpkg --configure -a
pd#admin:~$ sudo apt-get install appname_mention_here
Reading package lists... Done
Building dependency tree
Reading state information... Done
Now its working the installation....!
Simply use Open JDK like so...
sudo apt-get install openjdk-6-jre-headless
since you can only ssh into anyway... :)