Docker編-Centos 7 docker構築ベースミラー(centos+jdk 1.8+maven 3+git)

1910 ワード

1ターゲットミラー環境
centos7 jdk1.8 maven3 git
2構築プロセス
2.1 jdk 1.8とmaven 3.6.3の準備
#1)ダウンロードhttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html http://mirror-hk.koddos.net/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz #2)指定ディレクトリmkdir/opt/image&&cd/opt/image tar xvfz jdk-8 u 221-linux-x 64.tar.gz-C/opt/image tar xvfz apache-maven-3.6.3-bin.tar.gz-C/opt/iに解凍mage
2.2 Dockerfileの準備
cd/opt/image vim Dockerfileの内容は以下の通りです.
FROM centos
MAINTAINER guici

#     :    
RUN mkdir -p /opt/tools/jdk/
RUN mkdir -p /opt/tools/maven/

#   git(   )
RUN yum -y install git

#  jdk1.8.0_221     centos /opt/tools/jdk/jdk_1.8/   
COPY jdk1.8.0_221/ /opt/tools/jdk/jdk_1.8/

#  apache-maven-3.6.3     centos /opt/tools/maven/maven_3.6.3/   
COPY apache-maven-3.6.3/ /opt/tools/maven/maven_3.6.3/

#       
ENV JAVA_HOME /opt/tools/jdk/jdk_1.8
ENV MAVEN_HOME /opt/tools/maven/maven_3.6.3
ENV PATH $PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

2.3ミラーの構築
docker build -t base:v1.0-git-mvn363-jdk180221 .
Docker篇-Centos7 docker构建基础镜像(centos+jdk1.8+maven3+git)_第1张图片
#docker run-it base:v 1.0-git-mvn 363-jdk 180221/bin/bashをチェック
Docker篇-Centos7 docker构建基础镜像(centos+jdk1.8+maven3+git)_第2张图片