[root@vm02 ~]# docker p_w_picpaths REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos latest d5c89a2047c8 2 weeks ago 196.7 MB
[root@vm02 ~]# mkdir -p /dockerfile/tomcat/ [root@vm02 ~]# cd /dockerfile/tomcat/ [root@vm02 tomcat]# vim Dockerfile #version: 0.1 #authoer: zhenglm #base p_w_picpaths FROM centos MAINTAINER zhenglm@xx.com RUN yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y #RUN mkdir /work #VOLUME /data/home /home COPY run.sh /work/run.sh EXPOSE 10004 CMD ["sh","/work/run.sh"]
[root@vm02 tomcat]# ls /home/platform-pay/ bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work [root@vm02 tomcat]# vim run.sh #!/bin/bash # /home/platform-pay/bin/catalina.sh start while true;do echo 'ok' sleep 1 done ~ ~ [root@vm02 tomcat]# ls Dockerfile run.sh
[root@vm02 tomcat]#docker build -t platform_javaenv:v1 /dockerfile/tomcat/
[root@vm02 tomcat]# docker run -d -p 10004:10004 -v /data/home:/home --name paltfrom-pay01 da0e00856e03 219b6e7975e2a1363458e0e0bc7a7286148b6418cb247b3a12950b32948edd7e
[root@vm02 tomcat]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 219b6e7975e2 da0e00856e03 "sh /work/run.sh" 5 minutes ago Up 5 minutes 0.0.0.0:10004->10004/tcp paltfrom-pay01
訪問:java