dockerfile ENTRYPOINT执行脚本文件报错:no such file or directory

v1-alpha 发布于 2017/07/31 17:57
阅读 1K+
收藏 0

基础镜像: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也是这个错。好神奇。

加载中
0
v1-alpha
v1-alpha

找到问题所在了,见https://yq.aliyun.com/articles/68245

返回顶部
顶部