1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Oracle JDKをインストールしたDockerイメージを作る(yum

Last updated at Posted at 2017-02-04

環境

# Docker for Mac
$ docker -v
Docker version 1.13.0, build 49bf474

JDKが置いてあるURLの形式が昔から変わっていたので、URL自体とファイル名をパラメータとして渡せるようにした。
それ以外は、ライセンス同意のCookieを付けているくらい。

http://download.oracle.com/otn-pub/java/jdk/{8u121-b13:version}/{e9e7ea248e2c4826b92b3f075a80e441:ランダムっぽい文字列}/{jdk-8u121-linux-x64.rpm:ファイル名}

URLとファイル名はOracleのダウンロードページでライセンスに同意して取得。

スクリーンショット 2017-02-04 18.50.00.png
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}

ビルド

$ 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は指定するパラメータ分必要なことに地味にハマった。

参考

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?