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.
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!
I have a set up of Protractor, for which I need java in my Dockerfile to run the selenium-server.jar file.
Here is my Dockerfile
FROM node:latest
ENV CHROME_VERSION "google-chrome-stable"
RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \
&& apt-get -o Acquire::Check-Valid-Until=false update && apt-get -o Acquire::Check-Valid-Until=false install wget -y
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \
&& apt-get -o Acquire::Check-Valid-Until=false update && apt-get -qqy --allow-unauthenticated install ${CHROME_VERSION:-google-chrome-stable}
# Add the dependencies to get the xenial apt sources
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN apt-get -y update
# Add these silent accept - since oracle installer asks for permission to install java-version-8
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 seen true" | debconf-set-selections
# Install java-8
RUN apt install -y oracle-java8-installer && apt install oracle-java8-set-default
This set up was working fine until yesterday but since then I've been getting this error
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 install -y oracle-java8-installer && apt install oracle-java8-set-default' returned a non-zero code: 100
Now before marking this question as a duplicate , please see that I have gone through a lot of similar SO posts and applied all the changes mentioned but the error still persists or I get a new error, which circles back to this unable to download error.
I have tried the solutions mentioned in this, this, this and this, this, this, this but haven't been able to solve it.
The complete log file is here. If required, I can post the error that I got when trying to apply the solutions mentioned.
Looking for any pointers to solve this issue.
Do you really need to have oracle jdk? In the pass, I used the content of Dockerfile from openjdk to build an image from node and having java installed: https://github.com/docker-library/openjdk/blob/master/8/jdk/Dockerfile
Nevertheless, in your case, I would build a centralized selenium server or use a directConnect in CI pipeline.
Docker will remember the result of running each command unless you explicitly tell it not to (docker build --no-cache). In particular, it will skip over running the apt-get update step if it thinks it’s already done this.
Meanwhile, the Debian and Ubuntu repositories update frequently, and when they update, they remove old versions of packages. This means that if you’re using yesterday’s version of the package cache, you’ll get “download failed” errors like you see until you re-run apt-get update.
In a Docker context, the correct answer to this is to always run apt-get update and apt-get install in the same RUN step. You might change the end of your Dockerfile to look like
RUN apt-get update -y \
&& apt install oracle-java8-installer oracle-java8-set-default
Once you’ve gotten past the initial development stage it’s probably good practice to just have a single apt install command in your Dockerfile that does one pass at installing all of the runtime dependencies you need.
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
To insall java 8 on docker container, I used this command in dockerfile
RUN curl -LO 'http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm'
-H 'Cookie: oraclelicense=accept-securebackup-cookie' RUN rpm -i jdk-8u111-linux-x64.rpm RUN rm jdk-8u111-linux-x64.rpm
It worked for awhile, but now this link is not no longer available. Is there replaceable url for this? or easy way to insall java 8 on docker?
It's up to your using OS, so I'd like you to show your OS. For example, Ubuntu users prepares their ppa repository for Oracle Java.
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN apt-get install oracle-java8-installer
It seems that Oracle has changed the authorization for downloading, the actual link that the browser uses is http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm?AuthParam=1496223138_c808095f7637d83147c37d69d3a87e7a, but this cannot be used with curl.
I have no solution for the problem with downloading from Oracle, but I use the official OpenJDK image as base and have found no problems with that.
If openjdk is OK for you, you can use
RUN apt-get install -y openjdk-8-jdk
openjdk, in contrast to oracle, does not require user's confirmation.
If you only need java runtime, consider openjdk-8-jre.
Adaption of my Dockerfile from https://hub.docker.com/r/sftech/java
FROM ubuntu
ENV JAVA_VERSION=8
RUN echo oracle-java${JAVA_VERSION}-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& apt-add-repository ppa:webupd8team/java \
&& apt-get update \
&& apt-get install -y oracle-java${JAVA_VERSION}-installer \
&& update-java-alternatives -s java-${JAVA_VERSION}-oracle \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Why would you install java in an image / container, when you can get a java:8 image from the Docker store for free. The license requirements are exactly the same as the java / jdk download install from the oracle.com website.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Try:
sudo apt-get install maven
If it works for you ignore the rest of this post.
Intro
I started setting up my Ubuntu 12.10 on April 2013 and the normal sudo apt-get install maven was not working for maven 3 back then.
The manual installation in this post is useful if you like to dig in deeper to your ubuntu kernel in regards with apt-get and where it finds the list of applications that are available for installation on Ubuntu
. It can also be potentially useful for more recent releases of Ubuntu like Ubuntu 15.04, etc. if you face the same problem as I did back then with Ubuntu 12.10.
Automatic Installation via apt-get:
Checkout the manual installation if your current ubuntu can not install maven via common 'apt-get install maven'.
sudo apt-get update
sudo apt-get install maven
Make sure to remove maven 2 if your ubuntu is not fresh or if you were using maven 2 before:
sudo apt-get remove maven2
Manual Installation via apt-get by adding maven 3 repository (Ubuntu 14.04 check out update 1):
This can be useful if your ubuntu apt-get repositories list is not up to date.
Maven 3 was required to set up the system and as it turns out most of the documents out there are referring to how to install Maven to Ubuntu version 12.04 or before. Best document I found was:
killertilapia's blog
The whole process I came up with is as follows:
sudo -H gedit /etc/apt/sources.list
Add the following line the sources.list file:
deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main
deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main
sudo apt-get update && sudo apt-get install maven3
sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn
Caution 1: command "sudo apt-add-repository ppa:natecarlson/maven3" did not work on my Ubuntu and had to run sudo apt-add-repository -rm ppa:natecarlson/maven3 to get my apt-get to work again.
Caution 2: thanks to David, you need to remove your existing symbolic link to previous versions of maven before running step 4.
OS X Installation
I decided to add OS X installation in case you use multiple environments for your dev: See the source stackoverflow thread for more details.
Install Homebrew that is the equavalent of apt-get, then install Maven using:
brew install maven
Update 1: Installation for Ubunutu 14.04
Haven't tried this myself but I am confident this should work without security warnings:
sudo apt-get purge maven maven2 maven3
sudo apt-add-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
Note: source here, many thanks and +1s to #rendybjunior, #Dominic_Bartl, and #FunThomas424242
Here's an easier way:
sudo apt-get install maven
More details are here.
It's best to use miske's answer.
Properly installing natecarlson's repository
If you really want to use natecarlson's repository, the instructions just below can do any of the following:
set it up from scratch
repair it if apt-get update gives a 404 error after add-apt-repository
repair it if apt-get update gives a NO_PUBKEY error after manually adding it to /etc/apt/sources.list
Open a terminal and run the following:
sudo -i
Enter your password if necessary, then paste the following into the terminal:
export GOOD_RELEASE='precise'
export BAD_RELEASE="`lsb_release -cs`"
cd /etc/apt
sed -i '/natecarlson\/maven3/d' sources.list
cd sources.list.d
rm -f natecarlson-maven3-*.list*
apt-add-repository -y ppa:natecarlson/maven3
mv natecarlson-maven3-${BAD_RELEASE}.list natecarlson-maven3-${GOOD_RELEASE}.list
sed -i "s/${BAD_RELEASE}/${GOOD_RELEASE}/" natecarlson-maven3-${GOOD_RELEASE}.list
apt-get update
exit
echo Done!
Removing natecarlson's repository
If you installed natecarlson's repository (either using add-apt-repository or manually added to /etc/apt/sources.list) and you don't want it anymore, open a terminal and run the following:
sudo -i
Enter your password if necessary, then paste the following into the terminal:
cd /etc/apt
sed -i '/natecarlson\/maven3/d' sources.list
cd sources.list.d
rm -f natecarlson-maven3-*.list*
apt-get update
exit
echo Done!