dockerfile - docker run 报错文件路径不存在
为情所困
为情所困 2017-04-25 09:03:20
0
2
898

我是刚接触docker的小白,今天试着用dockerfile 构建一个tomcat镜像
结果在docker run 镜像时 报错

/bin/sh: /usr/local/tomcat/bin/startup.sh: No such file or directory

我的dockerfile 文件内容如下: 请高手指点一下。谢谢

# tomcat # # VERSION 1.0 # 使用centos作为基准镜像 FROM centos MAINTAINER lilin # 使用root用户 USER root ADD ./jdk-8u111-linux-x64.rpm /root ADD ./tomcat /usr/local #set environment variable ENV JAVA_HOME /root/jdk-8u111-linux-x64 ENV PATH $JAVA_HOME/bin:$PATH # 设置Tomcat7初始化运行,SSH终端服务器作为后台运行 ENTRYPOINT /usr/local/tomcat/bin/startup.sh && tail -F /usr/local/tomcat/logs/catalina.out # 对外(其他容器)开放8080端口 EXPOSE 88
为情所困
为情所困

reply all (2)
仅有的幸福

Having a dockerfile does not necessarily mean you have an image file. You can build the image file throughdocker build -t ${tagName} .. Then create a CONTAINER through the image file, and your container will eventually be able to run. For your current example you can complete the above process with the following command:

sudo docker build -t mytomcat . sudo docker run -p 8080:8080 mytomcat //在这里你可以加上特定参数
    曾经蜡笔没有小新

    Before writing the Dockerfile yourself, it is best to practice the Dockerfile building process first.
    According to your own logic, create and enter the container through the basic image, execute the commands you want to write in the Dockerfile first, see if there are any problems, and solve these problems, and then summarize all the commands and write them into a Dockerfile.
    Instead of writing a Dockerfile directly on paper.

    The error here is obvious. The Tomcat startup script/usr/local/tomcat/bin/startup.shdoes not exist, so the container cannot be started. Please practice building Tomcat in a container first, see how Tomcat should be started, what problems are missing in the startup, solve all the problems, and the Tomcat you built can run, and then write these things into a Dockerfile. Writing a Dockerfile in an empty space seems to be very powerful and saves practice, but in fact it is just a waste of time.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!