简体   繁体   中英

Docker python3: can't find '__main__' module

When I run

docker-compose up --build

I get the following error:

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"]

If glm-plotter refers to this repository, then according to its documentation you should run python glm-plotter.py .

Accordingly, you should change your Dockerfile to:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM