我遇到的问题是,在我尝试运行 docker-compose up 之后,在下载所有内容(python 依赖项)之后,docker-compose 将继续运行
Recreating sensorarray_web_1...
Attaching to sensorarray_web_1
我的目录结构如下所示:
.
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
└── sensoryarray.py
Dockerfile:
FROM python:2.7
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code
CMD python sensorarray.py
码头工人-compose.yml
web:
build: .
command: python sensorarray.py
ports:
- "5000:5000"
volumes:
- .:/code
感官阵列.py:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
我还运行了 docker hello world 示例,它似乎工作正常。