【Docker】Dockerfile使用apt-get来安装jdk

  前面谈过使用wget来从oracle下载jdk安装文件是使用了cookie欺骗的方法来越过身份验证来使用Dockerfile在ubuntu内安装oracle版本的jdk的。

  然而正道还是用apt-get来安装oracle jdk,现在更新一种使用apt-get来安装oracle jdk的Dockerfile配置:

 1 #VERSION 0.0.1
 2 #默认ubuntu server版本
 3 FROM ubuntu
 4 # 签名
 5 MAINTAINER linxiong "linxiong945@gmail.com"
 6 
 7 #安装jdk7
 8 RUN sed 's/main$/main universe/' -i /etc/apt/sources.list
 9 RUN apt-get update && apt-get install -y software-properties-common python-software-properties
10 RUN add-apt-repository ppa:webupd8team/java -y
11 
12 RUN apt-get update
13 RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
14 
15 RUN apt-get install -y oracle-java7-installer

  这样就可以用apt-get来安装oracle jdk了!!

原文地址:https://www.cnblogs.com/linxiong945/p/4204060.html