我正在构建一个小型的Python(烧瓶)应用程序。
映像已成功构建,但是容器未运行。当我运行docker ps
时,找不到正在运行的Container。泊坞窗日志也显示uwsgi not found
identidock.py:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_docker():
return 'Hellow docker!\n'
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
Dockerfile:
FROM python:3.6
RUN pip install Flask==0.10.1
RUN pip install uWSGI==2.0.17
WORKDIR /app
COPY app /app
CMD ["uwsgi", "--http", "0.0.0.0:9090". "--wsgi-file",
"/app/identidock.py", "--callable", "app", "--stats", "0.0.0.0:9191"]
命令已运行:
sudo docker build -t identidock . <<< no problem
sudo docker run -d -p 9090:9090 -p 9191:9191 identidock << no problem
sudo docker ps << empty
sudo docker logs <container ID> > >>/bin/sh: 1: [uwsgi,: not found
答案 0 :(得分:1)
如果您使用此行CMD ["uwsgi", "--http", "0.0.0.0:9090". "--wsgi-file", "/app/identidock.py", "--callable", "app", "--stats", "0.0.0.0:9191"]
构建docker映像,则"0.0.0.0:9090"
后会有一个点,需要更改,
。
Docker文件应为:
FROM python:3.6
RUN pip install Flask==0.10.1
RUN pip install uWSGI==2.0.17
WORKDIR /app
COPY app /app
CMD ["uwsgi", "--http", "0.0.0.0:9090", "--wsgi-file", "/app/identidock.py", "--callable", "app", "--stats", "0.0.0.0:9191"]
这应该有效...