开发者社区> 问答> 正文

dockerfile ENTRYPOINT执行脚本文件报错:no such fi?400报错

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

展开
收起
爱吃鱼的程序员 2020-06-08 11:57:03 1262 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

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

    2020-06-08 11:57:18
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载