问题
I am trying to create a Dockerfile/Image which has all softwares necessary to set up a Java environment.
As per work requirement, I have to use CentOS6 as my base image and Java6, Tomcat6, Apache2.2, Maven 3.2.5 and Eclipse.
Currently I have below as the Dockerfile:
#centos6
FROM centos:6
#Java
RUN yum -y install java-1.6.0-openjdk-devel.x86_64
VOLUME ["/var/www/thml", "/etc/httpd/conf", "/etc/httpd/conf.d", "/tmp/applications", "/usr/local/tomcat", "/usr/local/maven"]
EXPOSE 80 443
ENTRYPOINT [ "/usr/sbin/httpd","-k","start", "-D", "FOREGROUND" ]
# apache
RUN yum -y install httpd
RUN cp -fp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.ORG
RUN sed -i -e 's/\#ServerName www.example.com:80/ServerName example-web-server.example.com/g' /etc/httpd/conf/httpd.conf
I am not certain how to make sure that each RUN command is working correctly as in whether a Java6 environment is set correctly, then an Apache..etc.
回答1:
Use
RUN echo $JAVA_HOME
And while building the image using
docker build -t $YOUR_IMAGE_NAME
You can see the echo output in the build stdout which is printed on the console.
来源:https://stackoverflow.com/questions/48697481/how-do-you-make-sure-that-each-run-command-installment-is-working-inside-a-docke