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 yourapt-get install
commands is tellingapt-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: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-respository
is a part of thepython-software-properties
. Try putting yourapt-get update -y
command above yourapt-get install python-software-properties
command.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
I tried a few different things to no avail so I went with OpenJDK instead. This got me past this step and unto the next error :-).
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.