environment
# Docker for Mac
$ docker -v
Docker version 1.13.0, build 49bf474
Since the format of the URL where the JDK is placed has changed from long ago, the URL itself and the file name can be passed as parameters. Other than that, I put a cookie of license agreement.
http://download.oracle.com/otn-pub/java/jdk/{8u121-b13:version}/{e9e7ea248e2c4826b92b3f075a80e441:Random character string}/{jdk-8u121-linux-x64.rpm:file name}
Obtain the URL and file name by agreeing to the license on the Oracle download page.
Dockerfile
FROM amazonlinux
ARG jdk_url
ARG jdk_rpm_name
RUN \
yum install -y wget findutils which
RUN \
wget -q \
--no-check-certificate \
--no-cookies \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
${jdk_url}
RUN \
rpm -ivh ${jdk_rpm_name}
Build
$ docker build . --build-arg jdk_url=http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm --build-arg jdk_rpm_name=jdk-8u121-linux-x64.rpm
--build-arg
was soberly addicted to what was needed for the specified parameters.
Recommended Posts