In continuation to question, below is the updated docker file:
FROM microsoft/aspnetcore-build:1.0.1
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
# This is FROM openjdk:8-jdk
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils \
apt-transport-https \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get install -y --no-install-recommends apt-transport-https ca-certificates
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys AA8E81B4331F7F50
# RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
RUN echo 'deb http://archive.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
RUN echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list
RUN echo "Acquire::Check-Valid-Until \"false\";" > /etc/apt/apt.conf.d/100disablechecks
# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
RUN { \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# ENV JAVA_VERSION 8u111
# ENV JAVA_DEBIAN_VERSION 8u111-b14-2~bpo8+1
# ENV JAVA_VERSION 8u222
# ENV JAVA_DEBIAN_VERSION 8u222-b10-1ubuntu1~18.04.1
ENV JAVA_VERSION 8u171
ENV JAVA_DEBIAN_VERSION 8u171-b11-1~bpo8+1
# see https://bugs.debian.org/775775
# and https://github.com/docker-library/java/issues/19#issuecomment-70546872
ENV CA_CERTIFICATES_JAVA_VERSION 20140324
RUN set -x \
&& apt-get update \
&& apt-get install -y \
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
&& rm -rf /var/lib/apt/lists/* \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
# see CA_CERTIFICATES_JAVA_VERSION notes above
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
##### END OF THE JDK
##### START Jenkins Slave Node Config settings
# Create Jenkins User
RUN useradd jenkins -m -s /bin/bash
RUN chown -R jenkins /home/jenkins
RUN chgrp -R jenkins /home/jenkins
RUN chown -R jenkins /tmp
RUN chgrp -R jenkins /tmp
# Add the jenkins user to sudoers
RUN echo "jenkins ALL=(ALL) ALL" >> etc/sudoers
# Must install docker to create docker images from docker container. Inception. Head... hurts.
# container must be called with -v /var/run/docker.sock:/var/run/docker.sock
RUN apt-get update && apt-get install -y --no-install-recommends \
docker-engine \
&& rm -rf /var/lib/apt/lists/*
# This must run after the docker install
RUN gpasswd -a jenkins docker
USER jenkins
Below is the error:
Step 16/26 : RUN set -x && apt-get update && apt-get install -y openjdk-8-jdk="$JAVA_DEBIAN_VERSION" ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" && rm -rf /var/lib/apt/lists/* && [ "$JAVA_HOME" = "$(docker-java-home)" ]
---> Running in 6d823a145982
+ apt-get update
Get:1 https://apt.dockerproject.org debian-jessie InRelease [48.7 kB]
Get:2 http://archive.debian.org jessie-backports InRelease [166 kB]
Get:3 https://apt.dockerproject.org debian-jessie/main amd64 Packages [7366 B]
Get:4 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:5 http://deb.debian.org jessie-updates InRelease [16.3 kB]
Get:6 http://archive.debian.org jessie-backports/main amd64 Packages [1171 kB]
Get:7 http://deb.debian.org jessie Release.gpg [1652 B]
Get:8 http://deb.debian.org jessie Release [77.3 kB]
Get:9 http://security.debian.org jessie/updates/main amd64 Packages [892 kB]
Get:10 http://deb.debian.org jessie-updates/main amd64 Packages [20 B]
Get:11 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Fetched 11.5 MB in 14s (803 kB/s)
Reading package lists...
+ apt-get install -y openjdk-8-jdk=8u171-b11-1~bpo8+1 ca-certificates-java=20140324
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openjdk-8-jdk : Depends: openjdk-8-jre (= 8u171-b11-1~bpo8+1) but it is not going to be installed
Depends: openjdk-8-jdk-headless (= 8u171-b11-1~bpo8+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
ERROR: Service 'slavedotnet' failed to build: The command '/bin/sh -c set -x && apt-get update && apt-get install -y openjdk-8-jdk="$JAVA_DEBIAN_VERSION" ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" && rm -rf /var/lib/apt/lists/* && [ "$JAVA_HOME" = "$(docker-java-home)" ]' returned a non-zero code: 100
How to resolve this version issue?
See this:
The backports repository is deactivated by default. So, if you want to install a backported package, you will have to state that explicitly.
For example:
debian:/home/human# aptitude -t buster-backports install cockpit
So, for your case, you need to change to next:
apt-get install -t jessie-backports -y \
openjdk-8-jdk \
ca-certificates-java \
Here, I suggest you don't add version selection for package like next:
openjdk-8-jdk="$JAVA_DEBIAN_VERSION"
Because, default it will choose the latest version in this os release apt repo. If you insist, then for backports repo, you need to separate install them:
apt-get install -t jessie-backports -y \
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" && \
apt-get install -t jessie-backports -y \
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
Below command:
FROM microsoft/aspnetcore-build:1.0.1
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
# This is FROM openjdk:8-jdk
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils \
apt-transport-https \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get install -y --no-install-recommends apt-transport-https ca-certificates
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys AA8E81B4331F7F50
# RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
RUN echo 'deb http://archive.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
RUN echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list
RUN echo "Acquire::Check-Valid-Until \"false\";" > /etc/apt/apt.conf.d/100disablechecks
# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
RUN { \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# ENV JAVA_VERSION 8u111
# ENV JAVA_DEBIAN_VERSION 8u111-b14-2~bpo8+1
ENV JAVA_VERSION 8u171
ENV JAVA_DEBIAN_VERSION 8u171-b11-1~bpo8+1
# see https://bugs.debian.org/775775
# and https://github.com/docker-library/java/issues/19#issuecomment-70546872
ENV CA_CERTIFICATES_JAVA_VERSION 20140324
# RUN set -x \
# && apt-get update \
# && apt-get install -y \
# openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
# ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
# && rm -rf /var/lib/apt/lists/* \
# && [ "$JAVA_HOME" = "$(docker-java-home)" ]
RUN set -x \
&& apt-get update \
&& apt-get install -y openjdk-8-jre-headless ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
&& apt-get install -y openjdk-8-jre-headless \
openjdk-8-jdk-headless \
openjdk-8-jre \
openjdk-8-jdk \
# ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
&& rm -rf /var/lib/apt/lists/* \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
# see CA_CERTIFICATES_JAVA_VERSION notes above
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
##### END OF THE JDK
##### START Jenkins Slave Node Config settings
# Create Jenkins User
RUN useradd jenkins -m -s /bin/bash
RUN chown -R jenkins /home/jenkins
RUN chgrp -R jenkins /home/jenkins
RUN chown -R jenkins /tmp
RUN chgrp -R jenkins /tmp
# Add the jenkins user to sudoers
RUN echo "jenkins ALL=(ALL) ALL" >> etc/sudoers
# Must install docker to create docker images from docker container. Inception. Head... hurts.
# container must be called with -v /var/run/docker.sock:/var/run/docker.sock
RUN apt-get update && apt-get install -y --no-install-recommends \
docker-engine \
&& rm -rf /var/lib/apt/lists/*
# This must run after the docker install
RUN gpasswd -a jenkins docker
USER jenkins
gives error:
Step 16/26 : RUN set -x && apt-get update && apt-get install -y openjdk-8-jre-headless ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" && apt-get install -y openjdk-8-jre-headless openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jdk && rm -rf /var/lib/apt/lists/* && [ "$JAVA_HOME" = "$(docker-java-home)" ]
---> Running in 3733400f9098
+ apt-get update
Get:1 https://apt.dockerproject.org debian-jessie InRelease [48.7 kB]
Get:2 http://archive.debian.org jessie-backports InRelease [166 kB]
Ign http://deb.debian.org jessie InRelease
Get:3 http://deb.debian.org jessie-updates InRelease [16.3 kB]
Get:4 http://security.debian.org jessie/updates InRelease [44.9 kB]
Get:5 http://deb.debian.org jessie Release.gpg [1652 B]
Get:6 http://deb.debian.org jessie Release [77.3 kB]
Get:7 https://apt.dockerproject.org debian-jessie/main amd64 Packages [7366 B]
Get:8 http://archive.debian.org jessie-backports/main amd64 Packages [1171 kB]
Get:9 http://deb.debian.org jessie-updates/main amd64 Packages [20 B]
Get:10 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Get:11 http://security.debian.org jessie/updates/main amd64 Packages [892 kB]
Fetched 11.5 MB in 14s (818 kB/s)
Reading package lists...
+ apt-get install -y openjdk-8-jre-headless ca-certificates-java=20140324
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openjdk-8-jre-headless : Breaks: ca-certificates-java (< 20160321~) but 20140324 is to be installed
E: Unable to correct problems, you have held broken packages.
ERROR: Service 'slavedotnet' failed to build: The command '/bin/sh -c set -x && apt-get update && apt-get install -y openjdk-8-jre-headless ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" && apt-get install -y openjdk-8-jre-headless openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jdk && rm -rf /var/lib/apt/lists/* && [ "$JAVA_HOME" = "$(docker-java-home)" ]' returned a non-zero code: 100
How to resolve the certificate dependency?
It seems Debian does not support openjdk-8-jdk anymore due to a security issue. What is the easiest way to install openjdk-8-jdk for Debian 10 (Buster)?
Alternatively, you can use adoptopenjdk repository:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
https://adoptopenjdk.net/installation.html
WARNING: this answer suggest unsupported and dangerous mixing of
Debian releases. Follow the advice on your own risk, as it can break
the system on upgrades, as explained in
http://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian
Package mirror search steps:
In the Search package directories search for openjdk-8-jdk. You can see two results:
stretch (oldstable) (java): OpenJDK Development Kit (JDK)
sid (unstable) (java): OpenJDK Development Kit (JDK)
Choose stretch repository
Scroll to the Download openjdk-8-jdk section and choose your architecture. For example amd64
Now you can see mirrors list and instructions how to install the package via apt:
You should be able to use any of the listed mirrors by adding a line
to your /etc/apt/sources.list like this:
deb http://security.debian.org/debian-security stretch/updates main
Installation steps:
Install software source manager
apt-get update
apt-get install software-properties-common
Add mirror with openjdk-8-jdk
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main'
apt-get update
Install openjdk 8
apt-get install openjdk-8-jdk
Note: You can use steps above to find an official Debian mirror with any other package you want to install
You can search the Debian packages site and find out the openjdk-8-jdk package for Debian 10 is only available from unstable (sid) repository currently.
At first it is good to check and save current system-wide symbolic links for already installed Java SDK/JRE packages if any:
ls -la /etc/alternatives | grep java > previous-java-alternatives.txt
Then check is this package can be installed with current configuration:
apt-cache policy openjdk-8-jdk
If no then you need to add unstable repository to the sources list.
The negative output may imply that you prefer to use stable repositories and usually it isn't appropriate for you to update all other software from unstable repositories.
So before adding unstable repository to the sources list make sure APT::Default-Release configuration option is set to "stable":
grep -r Default-Release /etc/apt/
If no (as by default) then set it as recommended in that answer by creating this file:
/etc/apt/apt.conf.d/99defaultrelease
APT::Default-Release "stable";
Now you're ready to add the unstable repository to the sources list.
Before I prefer to check what mirror was selected by me when system was installed. Just look to main sources list:
cat /etc/apt/sources.list
In my case the output shows that mirror.yandex.ru server is used as system source. So I use the same for unstables and add this file:
/etc/apt/sources.list.d/91-debian-unstable.list
deb http://mirror.yandex.ru/debian/ unstable main
deb-src http://mirror.yandex.ru/debian/ unstable main
(I also have 90-debian-testing.list file for the testing repo.)
Then update package lists:
apt update
And check you system wont update from unstable sources:
apt list --upgradable
And recheck is required package can be installed:
apt-cache policy openjdk-8-jdk
Do install the package:
apt install openjdk-8-jdk
Look at new symbolic links:
ls -la /etc/alternatives | grep java-8
Just waste few seconds on them (or continue with man 1 update-alternatives).
This is my script which I use to install OpenJDK 8 on Bitbucket's Pipelines Docker image NodeJS 10.16.2.
But now I see that this docker image is based on Stretch...
It is based on https://github.com/docker-library/openjdk/blob/89851f0abc3a83cfad5248102f379d6a0bd3951a/8-jdk/Dockerfile
#!/bin/bash
set -x #echo on
# based on https://github.com/docker-library/openjdk/blob/89851f0abc3a83cfad5248102f379d6a0bd3951a/8-jdk/Dockerfile
apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils &&
rm -rf /var/lib/apt/lists/*
echo 'deb http://httpredir.debian.org/debian-security stretch/updates main' >/etc/apt/sources.list.d/jessie-backports.list
# Default to UTF-8 file.encoding
export LANG=C.UTF-8
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
{ \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JAVA_VERSION=8u252
export JAVA_DEBIAN_VERSION=8u252-b09-1~deb9u1
# see https://bugs.debian.org/775775
# and https://github.com/docker-library/java/issues/19#issuecomment-70546872
export CA_CERTIFICATES_JAVA_VERSION=20170929~deb9u3
set -x \
&& apt-get update \
&& apt-get install -y \
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
&& rm -rf /var/lib/apt/lists/* \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
# see CA_CERTIFICATES_JAVA_VERSION notes above
/var/lib/dpkg/info/ca-certificates-java.postinst configure
UPDATE
Things change, versions are upped. Here is the latest script which works for https://hub.docker.com/layers/node/library/node/10.16.2/images/sha256-8f420c033acee137f9e902092a04d371bdf1f839559cce60614c0d5905d20294?context=explore
#!/bin/bash
set -x #echo on
# based on https://github.com/docker-library/openjdk/blob/89851f0abc3a83cfad5248102f379d6a0bd3951a/8-jdk/Dockerfile
apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils &&
rm -rf /var/lib/apt/lists/*
echo 'deb http://httpredir.debian.org/debian-security stretch/updates main' >/etc/apt/sources.list.d/jessie-backports.list
# Default to UTF-8 file.encoding
export LANG=C.UTF-8
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
{ \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JAVA_VERSION=8u265
export JAVA_DEBIAN_VERSION=8u265-b01-0+deb9u1
# see https://bugs.debian.org/775775
# and https://github.com/docker-library/java/issues/19#issuecomment-70546872
export CA_CERTIFICATES_JAVA_VERSION=20170929~deb9u3
set -x \
&& apt-get update \
&& apt-get install -y \
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
&& rm -rf /var/lib/apt/lists/* \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
# see CA_CERTIFICATES_JAVA_VERSION notes above
/var/lib/dpkg/info/ca-certificates-java.postinst configure
I needed to install a 32-bit version but this wasn't available at adoptopenjdk far as I could see. I tracked down a copy of a binary at java.com i their downloads area:
jre-8u241-linux-i586.tar.gz
All I needed was the JRE (rather than a JDK, but the process should be the same for either) and since it was also for a personal use only, the Oracle binary was OK (they have limitations in this regard).
I downloaded the binary and placed it in the home folder (~/) of the user that needed to run it and then unzipped it like so:
mkdir ~/java && cd ~/java && tar -xf jre-8u241-linux-i586.tar.gz
Then added the location to the path of the user that would run the Java application by appending this line to ~/.profile:
export PATH=$PATH:/home/youruserid/java/jre1.8.0_241/bin
This worked fine for my case but there are no doubt better ways to install a binary. For example so it is available for all Unix users rather than just one.
The easiest way to install JDK8 is using SDKMAN.
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk install java 8.0.275.hs-adpt
Based one some of the above answers, this is what i used in my shell script on debian buster silm os running node 12.x (node:12.6-buster-slim)
This was in preparing to move to github actions local testing with act, do note that there is no need for sudo as ci testing in this container already is root.
apt-get update -qq
#software-properties-common not installed on slim
apt-get install software-properties-common -y -q
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add -
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update -qq
#man folder needs to be available for adoptopenjdk-8 to finish configuring
mkdir -p /usr/share/man/man1/
apt-get install adoptopenjdk-8-hotspot -y
#ensure openjdk-8-jdk is found for some installations, thanks b8kich for the virtual wrapper
curl https://gitlab.com/b8kich/adopt-openjdk-8-jdk/-/raw/master/adopt-openjdk-8-jdk_0.1_all.deb?inline=false -o adopt-openjdk-8-jdk_0.1_all.deb
dpkg -i adopt-openjdk-8-jdk_0.1_all.deb
I've found, mainly after years of working with deprecated iDrac consoles which have particular java requirements, that installing multiple versions of the JRE or JDK is preferable as you can choose between them as necessary without worrying about other dependencies or breaking your package manager.
This is actually incredibly easy on Debian, and very probably other linux, by eschewing the package manager all together and manually installing whatever versions you need.
Download your desired jre/jdk from the Oracle archives (You will need a free Oracle account) here for whatever architecture you need: https://www.oracle.com/java/technologies/downloads/archive/
I selected "Java SE 8 (8u211 and later)" from the menu and snagged jre-8u271-linux-x64.tar.gz.
From there, extract the archive to a location accessible to the user who will be running java; Typically I'll extract to "/usr/local/lib/jre1.8.0_271/".
From here you can run /usr/local/lib/jre1.8.0_271/bin/java successfully, as well as javaws.
/usr/local/lib/jre1.8.0_271/bin# ./java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
On most of my systems I already have some packaged version of jre installed that's native to the release, so my /usr/bin/java and /usr/bin/javaws typically are symlinks to /etc/alternatives/java /etc/alternatives/javaws, respectively.
To switch the system to a particular jre, just update the relevant symlinks to point to the version of your choice:
rm /usr/bin/java /usr/bin/javaws /usr/bin/jjs /usr/bin/jcontrol
for i in java javaws jjs jcontrol; do ln -s /usr/local/lib/jre1.8.0_271/bin/$i /usr/bin/$i; done
Note that if you need, per say, jre 7, 11 and 17 you can download and extract each version to a particular named folder in /usr/local/lib, or your home directory if you'll be launching it manually, and utilize each of them individually as needed by updating the symlinks or just running them directly.
I just faced a similar problem:
I have on old HP-mini 210 netbook to be used as a "car logger" and it has to use java 8 32bit (required by the logger application).
I'm running a light distro based on Debian 10 (BunsenLabs Lithyum).
After poking around the easyest way I found to install java 8 32bits was by using an openjdk 8 deb package published by OpenLogic (they have 32 or 64 bits):
https://www.openlogic.com/openjdk-downloads
Just download and install (package manager). Worked 100% and now I have a super fast hp-mini "car logger".
I was migrating from Jessie to Buster, and found that not-so-old, legacy code would not compile and run on JDK11.
I managed to copy all java8 folders from my Jessie distribution, reworked the links, and set that as a new JDK on Eclipse. That works so far.
the easiest way I have found to download java 8 on debian buster is to use the command su apt-get install openjdk-8-jdk
I am trying to connect DB2 as a data connection for airflow which is residing in a Docker Container (realizing that this is not nativly supported). I am developing on a Mac
I have added the connectionas seen in the below screenshot where the URL is host:port/databse.
I am then going to the Data Profiling > Ad Hoc Query to try and test the connection and I get the below.
In order to make sure the drivers were available, I mounted the folder where the jdbc driver is located to /usr/local/airflow/drivers in the docker-compose file.
I also made sure to include the below packages in my requirements.txt as these were required when I query from a jupyter notebook.
sasl
thrift_sasl
jaydebeapi
jpype1
ibm_db
ibm_db_sa
I can't figure out what I'm missing.
I've been through:
Airflow documentation
Unable to setup a DB2 / DashDB JDBC Connection in Apache Airflow
Apache Airflow db2 Connection
Apache Airflow db2 Connection
https://github.com/puckel/docker-airflow
Lots of GitHub issues
and many more resources but can't find anything that solves this
Here is my current Dockerfile. As indicated in the comments, JVM isn't installed in the Dockerfile so that may be the issue.
# VERSION 1.10.1
# AUTHOR: Matthieu "Puckel_" Roisil
# DESCRIPTION: Basic Airflow container
# BUILD: docker build --rm -t puckel/docker-airflow .
# SOURCE: https://github.com/puckel/docker-airflow
FROM python:3.6-slim
LABEL maintainer="Puckel_"
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
# Airflow
ARG AIRFLOW_VERSION=1.10.1
ARG AIRFLOW_HOME=/usr/local/airflow
ARG AIRFLOW_DEPS=""
ARG PYTHON_DEPS=""
ENV AIRFLOW_GPL_UNIDECODE yes
# Define en_US.
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LC_MESSAGES en_US.UTF-8
# Java
RUN apt-get update && apt-get install -y openjdk-7-jre-headless wget \
&& apt-get clean
ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
RUN set -ex \
&& buildDeps=' \
freetds-dev \
libkrb5-dev \
libsasl2-dev \
libssl-dev \
libffi-dev \
libpq-dev \
git \
' \
&& apt-get update -yqq \
&& apt-get upgrade -yqq \
&& apt-get install -yqq --no-install-recommends \
$buildDeps \
freetds-bin \
build-essential \
default-libmysqlclient-dev \
apt-utils \
curl \
rsync \
netcat \
locales \
&& sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& useradd -ms /bin/bash -d ${AIRFLOW_HOME} airflow \
&& pip install -U pip setuptools wheel \
&& pip install pytz \
&& pip install pyOpenSSL \
&& pip install ndg-httpsclient \
&& pip install pyasn1 \
&& pip install apache-airflow[crypto,celery,postgres,hive,jdbc,mysql,ssh${AIRFLOW_DEPS:+,}${AIRFLOW_DEPS}]==${AIRFLOW_VERSION} \
&& pip install 'redis>=2.10.5,<3' \
&& if [ -n "${PYTHON_DEPS}" ]; then pip install ${PYTHON_DEPS}; fi \
&& apt-get purge --auto-remove -yqq $buildDeps \
&& apt-get autoremove -yqq --purge \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
COPY script/entrypoint.sh /entrypoint.sh
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
COPY requirements.txt ${AIRFLOW_HOME}/requirements.txt
RUN pip install --upgrade pip && pip install -r requirements.txt
RUN chown -R airflow: ${AIRFLOW_HOME}
EXPOSE 8080 5555 8793
USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["/entrypoint.sh"]
CMD ["webserver"] # set default arg for entrypoint
The jpype1 module requires a JVM, accessible on your $PATH -- try installing one and try again.
Finally figured it out. Below is what I ended up using to get Java installed. then I just mounted the folder with my driver in it.
# Java
RUN mkdir -p /usr/share/man/man1 && \
(echo "deb http://http.debian.net/debian stretch main" > /etc/apt/sources.list.d/backports.list) && \
apt-get update -y \
&& apt-get install --no-install-recommends -y build-essential libkrb5-dev libsasl2-dev libffi-dev default-libmysqlclient-dev vim-tiny gosu krb5-user openjdk-8-jre openjdk-8-jdk-headless openjdk-8-jdk openjdk-8-jre-headless \
&& apt-get clean
RUN apt-get install unzip -y && \
apt-get autoremove -y
I've tried to install Java 8 into a ARM embedded linux in several ways but none of them worked:
First:
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
(from the repositories of webupd8)
W: Failed to fetch
http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/InRelease
Unable to find expected entry 'main/binary-armel/Packages' in Release
file (Wrong sources.list entry or malformed file)
W: Failed to fetch
http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/jessie/main/binary-armel/Packages
404 Not Found
E: Some index files failed to download. They have been ignored, or old
ones used instead.
It seems that this repo does not have the source for my architecture:
Architectures: amd64 arm64 armhf i386 powerpc ppc64el
And i need armel ( at least this is working for java 7 )
I also tried this way:
http://www.rpiblog.com/2014/03/installing-oracle-jdk-8-on-raspberry-pi.html
Downloading the jdk from Oracle and then following the instructions.
But i cannot execute the file :
root#arietta:~# java -version
-bash: /usr/bin/java: No such file or directory
and neither:
root#arietta:~# /opt/jdk1.8.0_71/bin/java -version
-bash: /usr/bin/java: No such file or directory
While the file exists and has the correct permissions... i'm going crazy..
Any idea or alternative method?
At the end i solved it adding jessie backports to the sources.list:
echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list
apt-get update && apt-get install openjdk-8-jdk
update-alternatives --config java
I ran the following commands from the webupd8 team and it worked for me:
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit
Same as #user2528085, you just need to add Debian backports to your sourcelist file.
Follow this instruction on Debian official site
https://backports.debian.org/Instructions/
Run these commands in shell:
echo "deb http://ftp.debian.org/debian jessie-backports main" | sudo tee -a /etc/apt/sources.list.d/jessie-backports.list
sudo apt-get update && sudo apt-get install elasticsearch
Nothing difficult