How do you make sure that each RUN command installment is working inside a Dockerfile?

陌路散爱 提交于 2020-01-06 06:16:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!