基础镜像:eop-base
#pull down centos image
FROM centos
MAINTAINER lisn@ffcs.cn
RUN yum -y install net-tools
#copy jdk and tomcat into image
ADD ./jre-7u80-linux-x64.gz /root
COPY ./tomcat /root/tomcat
#set environment variable
ENV JAVA_HOME /root/jre1.7.0_80
ENV PATH $JAVA_HOME/bin:$PATH
tomcat镜像:
FROM eop-base:v2.0
MAINTAINER xxxxx.cn
COPY ./xxxxx/ROOT.war /root/tomcat/webapps
ADD ./init.sh /root/
#RUN sh /root/init.sh
#define entry point which will be run first when the container starts up
ENTRYPOINT ls /root && ls /root/tomcat && ls /root/tomcat/conf && sh /root/init.sh && sh /root/tomcat/bin/startup.sh && tail -F /root/tomcat/logs/catalina.out
#ENTRYPOINT sh /root/tomcat/bin/startup.sh && tail -F /root/tomcat/logs/catalina.out
init.sh
cho '23423'
ls /
ls /root/tomcat/bin
ls /root
ls /root/tomcat
ls /root/tomcat/conf
sed -i "s/8080/8080/" /root/tomcat/conf/server.xml
sed -i "s/8080/$port/" /root/tomcat/conf/server.xml
docker build tomcat的dockerfile报错:
anaconda-ks.cfg init.sh jre1.7.0_80 original-ks.cfg tomcat
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work
catalina.policy catalina.properties context.xml logging.properties server.xml tomcat-users.xml web.xml
23423
: No such file or directory
: No such file or directorycat/bin
: No such file or directory
: No such file or directorycat
: No such file or directorycat/conf
: No such file or directoryt/conf/server.xml
: No such file or directoryt/conf/server.xml
把一些初始的命令放在init.sh里,启动时执行,当时报错No such file or directory。但是换成第二个ENTRYPOINT就可以执行。前面的ls可以执行,后面的tomcat启动脚本也可以执行,只有init.sh里面的命令报错。init.sh里面加!#/bin/bash也报错。RUN sh /root/init.sh也是这个错。好神奇。
找到问题所在了,见https://yq.aliyun.com/articles/68245
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。