【发布时间】:2020-05-14 07:13:22
【问题描述】:
Dockerfile:
FROM python:3.6-slim
ENV root=/test
ENV django=$root/test
COPY ./code $root
WORKDIR $django
RUN pip install -r requirements.txt --no-cache-dir
CMD ["python3", "manage.py", "runserver", "--noreload"]
没有 --noreload 会卡住
Watching for file changes with StatReloader
仅供参考,“docker run hello-world”工作正常。
仅供参考,在 windows 10 home 的 virtualbox 上运行 ubuntu(作为开发环境)
更新: 我已将基本图像更改为
来自 python:3.6
它有效,但问题仍然存在为什么它不适用于 slim?
【问题讨论】:
-
您应该在容器内使用
uwsgi或类似的东西运行它。runserver命令仅用于本地开发
标签: python django docker ubuntu virtualbox