Docker_实践
docker
·
使用docker部署Python Flask项目
- 先写好Dockerfile文件
- Dockerfile
FROM python:3.7.9
ADD . /home/pre_docker/pre_check_white
WORKDIR /home/pre_docker/pre_check_white
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install gunicorn==20.0.4
RUN pip install gevent==21.1.2
EXPOSE 5000
CMD ["gunicorn", "app:app", "-c", "gunicorn.py"]
- Build
docker build -t pre_check_test .
docker run -it -p 5000:5000 -v /home/pre_docker/pre_check_white:/home/pre_docker/pre_check_white--name="pre_check" pre_check_test
- Start
docker restart pre_check
更多推荐
已为社区贡献2条内容
所有评论(0)