Docker镜像运行时出错:找不到文件

时间:2019-04-03 13:13:02

标签: docker docker-compose dockerfile

FROM python:3.5 AS python-build
#ADDING WHOLE CODE TO FOLDER sequentialbot 
ADD . /sequentialbot 
#sequentialbot as WORKDIR
WORKDIR /sequentialbot
#INSTALLING PYTHON DEPENDENCY
RUN pip install -r requirements.txt

#FOR NODE MODULE
FROM node:11.10.0-alpine
#INSTALLING PYTHON HERE SOME PYTHON DEPENCY CAN ONLY INSTALL BY python:3.5 getting error in alpine,stretch etc 
RUN apk add --update --no-cache \
    python3-dev \
    make \
    g++
#COPY PYTHON DEPENDENCY FROM BASE
COPY --from=python-build /root/.cache /root/.cache
ADD . /sequentialbot
#NODE INSTALL
RUN npm install -g npm@latest
RUN npm cache verify
WORKDIR /sequentialbot/app/static
RUN npm install
RUN npm install sass -g
#SASS 
RUN sass --no-source-map scss/layout/_header.scss:css/layout/_header.css 
RUN sass --no-source-map scss/layout/_footer.scss:css/layout/_footer.css 
RUN sass --no-source-map scss/layout/_side_menu.scss:css/layout/_side_menu.css 
RUN sass --no-source-map scss/layout/_error_component.scss:css/layout/_error_component.css 
RUN sass --no-source-map scss/components/_input_box.scss:css/components/_input_box.css 
RUN sass --no-source-map scss/components/_button.scss:css/components/_button.css 
RUN sass --no-source-map scss/components/_loading_mask.scss:css/components/_loading_mask.css 
RUN sass  --no-source-map scss/components/_template_card.scss:css/components/_template_card.css 
RUN sass --no-source-map scss/pages/_onboarding_app.scss:css/pages/_onboarding_app.css 
RUN sass  --no-source-map scss/pages/_choose.scss:css/pages/_choose.css 
RUN sass --no-source-map scss/pages/_adapt.scss:css/pages/_adapt.css 
RUN sass --no-source-map scss/pages/_express.scss:css/pages/_express.css 
RUN sass --no-source-map scss/pages/_experience.scss:css/pages/_experience.css 
RUN sass --no-source-map scss/pages/_features.scss:css/pages/_features.css 
RUN sass --no-source-map scss/pages/_request_demo.scss:css/pages/_request_demo.css 
#bundle build
RUN npm run build
#SERVER.JS in node-src folder
WORKDIR /sequentialbot/node-src
EXPOSE 3000
ENTRYPOINT ["node", "server.js"]
#run.py inside sequentialbot folder 
WORKDIR /sequentialbot
EXPOSE 9595
ENTRYPOINT [ "python3", "./run.py" ]

我已经写了这个docker文件来构建我的applicatio。我的应用程序在python:3.5和node中。

在我使用以下命令运行此文件创建docker映像后:docker run <image name>未指定端口或其他东西,只是想检查输出

所以它给了我这样的错误:

  

python3:无法打开文件'./run.py':[错误2]没有此类文件或   目录

我知道一些路径问题,但是可以提出一些路径工作方式或可以共享一些参考码头工人文件的信息。

1 个答案:

答案 0 :(得分:1)

您可以将ENTRYPOINT更改为此吗?

ENTRYPOINT [ "python3", "/sequentialbot/run.py" ]

据我所知,WORKDIR对于在构建期间运行的命令有效。 ENTRYPOINT命令在容器启动过程中运行。