How do you make sure that each RUN command install

2019-08-27 18:14发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-27 19:04

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.

查看更多
登录 后发表回答