Dockerfile :
FROM python:3.8
LABEL maintainer="Zhen Chengchengzhen000000@163.com"
RUN pip install flask
COPY app.py /app/
WORKDIR /app
EXPOSE 5001
CMD python app.py
app.py:
from flask import Flask
app = Flask(name)
@app.route(’/’)
def hello():
return "hello docker"
if name == ‘main’:
app.run(debug=True,host=‘0.0.0.0’,port=8000)
build命令
docker build -t localhost:5000/flask_demo .
run命令
docker run -d --name localhost:5000/flask_demo localhost:5000/flask_demo
build过程中发现一个告警,不知道是否和这个有关
各种尝试都不行,麻烦老师解惑