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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With