Docker Python3:找不到'__main__'模块

时间:2018-10-02 04:53:44

标签: python docker

我跑步时

  

docker-compose up --build

我收到以下错误:

web_1  | /opt/conda/bin/python3: can't find '__main__' module in 'glm-plotter'

glm-plotter / glm-plotter.py:

...
if __name__ == "__main__":
    app.secret_key = 'B0er23j/4yX R~XHH!jmN]LWX/,?Rh'
    app.run()

Dockerfile

FROM continuumio/miniconda3
RUN apt-get update && apt-get install -y \
    libpq-dev \
    build-essential
RUN apt-get install -y python3
RUN apt-get install -y python3-pip

ADD . /code
WORKDIR /code
RUN pip3 install -r requirements.txt

RUN cd glm-plotter
RUN ls glm-plotter
CMD ["python3", "glm-plotter"]

1 个答案:

答案 0 :(得分:1)

如果glm-plotter引用了this存储库,则应根据其文档运行 python glm-plotter.py

因此,您应该将Dockerfile更改为:

CMD ["python3", "glm-plotter.py"]