簡體   English   中英

Docker Python3:找不到'__main__'模塊

[英]Docker python3: can't find '__main__' module

當我跑步

docker-compose up --build

我收到以下錯誤:

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

GLM繪圖儀/ 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"]

如果glm-plotter引用存儲庫,則根據其文檔,應運行python glm-plotter.py

因此,您應該將Dockerfile更改為:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM