您如何确保每个RUN命令批处理都在Dockerfile中正常工作? [英] How do you make sure that each RUN command installment is working inside a Dockerfile?
问题描述
我正在尝试创建一个Dockerfile / Image,其中包含设置Java环境所需的所有软件。
I am trying to create a Dockerfile/Image which has all softwares necessary to set up a Java environment.
根据工作要求,我必须使用CentOS6作为我的基本映像以及Java6,Tomcat6,Apache2.2,Maven 3.2.5和Eclipse。
As per work requirement, I have to use CentOS6 as my base image and Java6, Tomcat6, Apache2.2, Maven 3.2.5 and Eclipse.
当前,我将以下作为Dockerfile:
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
我不确定如何确保每个RUN命令是否可以像正确设置Java6环境一样正常工作,然后使用Apache..etc。
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.
推荐答案
使用
RUN echo $JAVA_HOME
然后在使用
docker build -t $YOUR_IMAGE_NAME
您可以在控制台上打印的build stdout中看到echo输出。
You can see the echo output in the build stdout which is printed on the console.
这篇关于您如何确保每个RUN命令批处理都在Dockerfile中正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!