docker maven tomcat java 安装
?
0.准备?
apache-maven-3.2.3-bin.tar.gz 下载
解压 ,修改 settings
class="java" name="code"><localRepository>/docker/maven/repos</localRepository>
?
?
?
1.编写docker file
############################################ # version:apache-maven-3.2.3-bin.tar.gz # desc : 当前版本安装的3.2.3 ############################################ # 设置继承自我们创建的 tools 镜像 FROM curiousby/centos-ssh-root-java-tomcat:original # 下面是一些创建者的基本信息 MAINTAINER baoyou curiousby@163.com # 复制 apache-tomcat-7.0.75.tar.gz 文件到镜像中 ADD apache-maven-3.2.3-bin.tar.gz /usr/local/ # 设置软连接 RUN ln -s /usr/local/apache-maven-3.2.3 /usr/local/maven # 设置 MAVEN 的环境变量,若读者有其他的环境变量需要设置 ENV MAVEN_HOME /usr/local/apache-maven-3.2.3 ENV PATH $MAVEN_HOME/bin:$PATH #设置 maven repository COPY settings.xml /usr/local/apache-maven-3.2.3/conf/ VOLUME ["/docker/maven/repos/"]
?
2.编译
docker build -t curiousby/centos-ssh-root-java-tomcat-maven:original .
?
?
docker build -t curiousby/centos-ssh-root-java-tomcat-maven:original . Sending build context to Docker daemon 15.26MB Step 1/8 : FROM curiousby/centos-ssh-root-java-tomcat:original ---> 7dd208c74262 Step 2/8 : MAINTAINER baoyou curiousby@163.com ---> Using cache ---> c549081b11d8 Step 3/8 : ADD apache-maven-3.2.3-bin.tar.gz /usr/local/ ---> 14a1ec8ac5ab Removing intermediate container 656d7770f3c5 Step 4/8 : RUN ln -s /usr/local/apache-maven-3.2.3 /usr/local/maven ---> Running in 529b55ca52de ---> d35e0d791544 Removing intermediate container 529b55ca52de Step 5/8 : ENV MAVEN_HOME /usr/local/apache-maven-3.2.3 ---> Running in 93fc2f58bd10 ---> 641a9a70efa5 Removing intermediate container 93fc2f58bd10 Step 6/8 : ENV PATH $MAVEN_HOME/bin:$PATH ---> Running in 8e010c4c8ee4 ---> e181bbcdcfaa Removing intermediate container 8e010c4c8ee4 Step 7/8 : COPY settings.xml /usr/local/apache-maven-3.2.3/conf/ ---> c88afe1f2bea Removing intermediate container 7b2d6cab9fc4 Step 8/8 : VOLUME /docker/maven/repos/ ---> Running in d9e5ee86904f ---> b41c76b72e83 Removing intermediate container d9e5ee86904f Successfully built b41c76b72e83 Successfully tagged curiousby/centos-ssh-root-java-tomcat-maven:original
?
4.运行
docker run -d -p 8080:8080 -v /docker/tomcat2/logs/:/usr/local/tomcat/logs -v /docker/maven/repos/:/docker/maven/repos/ curiousby/centos-ssh-root-java-tomcat-maven:original
?
?
?
5.测试?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。
?
个人主页:http://knight-black-bob.iteye.com/
?
?
?谢谢您的赞助,我会做的更好!