docker,maven,tomcat,nexus,java 安装
?
0.准备?
nexus-2.11.4-01-bundle.tar.gz 下载
?
1. 编写 docker profile
class="java">############################################ # version:nexus-2.11.4-01-bundle.tar.gz # desc : 当前版本安装的2.11.4 ############################################ # 设置继承自我们创建的 tools 镜像 FROM curiousby/centos-ssh-root-java-tomcat-maven:original # 下面是一些创建者的基本信息 MAINTAINER baoyou curiousby@163.com # 复制 apache-tomcat-7.0.75.tar.gz 文件到镜像中 ADD nexus-2.11.4-01-bundle.tar.gz /usr/local/ #设置软连接 RUN ln -s /usr/local/nexus-2.11.4-01 /usr/local/nexus # 容器需要开放nexus 8081端口 EXPOSE 8081 COPY nexus /usr/local/nexus/bin/ # 自启动 COPY nexus-autorun.sh /usr/local/nexus/bin/nexus-autorun.sh RUN chmod u+x /usr/local/nexus/bin/nexus-autorun.sh CMD ["/usr/local/nexus/bin/nexus-autorun.sh"]
?
?
2.编写自启动脚本nexus-autorun.sh
#!/bin/bash source ~/.bashrc sh /usr/local/nexus-2.11.4-01/bin/nexus start sh /usr/local/tomcat/bin/catalina.sh run
?
3.修改 nexus
?
vim nexus RUN_AS_USER=root
?
?
4.构建
docker build -t "curiousby/centos-ssh-root-java-tomcat-maven-nexus:original" .
?5.构建日志
Step 1/8 : FROM curiousby/centos-ssh-root-java-tomcat-maven:original ---> b41c76b72e83 Step 2/8 : MAINTAINER baoyou curiousby@163.com ---> Running in b6a55ea4eff6 ---> d19eca4a0677 Removing intermediate container b6a55ea4eff6 Step 3/8 : ADD nexus-2.11.4-01-bundle.tar.gz /usr/local/ ---> 57fc2633a883 Removing intermediate container 5922c25ce056 Step 4/8 : RUN ln -s /usr/local/nexus-2.11.4-01 /usr/local/nexus ---> Running in d7aa7e62fdce ---> 41a3adf2fdd7 Removing intermediate container d7aa7e62fdce Step 5/8 : EXPOSE 8081 ---> Running in 238cd800b1d0 ---> 1f26ae2f7a8b Removing intermediate container 238cd800b1d0 Step 6/8 : COPY nexus-autorun.sh /usr/local/nexus/bin/nexus-autorun.sh ---> ad06c187ab05 Removing intermediate container e882f4372079 Step 7/8 : RUN chmod u+x /usr/local/nexus/bin/nexus-autorun.sh ---> Running in 42cd7a0ad805 ---> 4ea9a7cab32f Removing intermediate container 42cd7a0ad805 Step 8/8 : CMD /usr/local/nexus/bin/nexus-autorun.sh ---> Running in 8a78f6fd6523 ---> 7e2243d74306 Removing intermediate container 8a78f6fd6523 Successfully built 7e2243d74306 Successfully tagged curiousby/centos-ssh-root-java-tomcat-maven-nexus:original
?
?
6.运行
docker run -d -p 8080:8080 -p 8081:8081 -v /docker/nexus/data/:/usr/local/nexus/sonatype-work -v /docker/tomcat2/logs/:/usr/local/tomcat/logs -v /docker/maven/repos/:/docker/maven/repos/ curiousby/centos-ssh-root-java-tomcat-maven-nexus:original
?
7。验证
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。
?
个人主页:http://knight-black-bob.iteye.com/
?
?
?谢谢您的赞助,我会做的更好!
?