Docker
Flask
新建 app.py
文件
From flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Flask Docker Hello Word'
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0')
新建 requirements.txt
文件
Flask==0.10.1
新建 Dockerfile
FROM ubuntu:latest
MAINTAINER dingdayu "6144220992@qq.com"
RUN sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.aliyun\.com\/ubuntu\//g' /etc/apt/sources.list
RUN apt-get -qqy update && \
apt-get install -y python-pip python-dev build-essential && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
docker build -t flask-docker-hello:latest .
docker run -d -p 5000:5000 flask-docker-hello
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有