问题:
测试容器,该容器基本上消除了仅运行Flask应用进行演示的问题中的任何第三方因素。
app.py
from flask import Flask
import os
import socket
app = Flask(__name__)
@app.route("/")
def hello():
html = "<h3>Hello World!</h3>"
return html
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
Dockerfile
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
# Run app.py when the container launches
CMD ["python", "app.py"]
docker-compose-yaml
version: '3'
services:
redash:
image: redash/redash
ports:
- "5001:5000"
test:
build: .
ports:
- "80:80"
完整日志:
$ docker-compose up
Starting test1_redash_1 ... done
Recreating test1_test_1 ... done
Attaching to test1_redash_1, test1_test_1
test1_redash_1 exited with code 0
test_1 | * Serving Flask app "app" (lazy loading)
test_1 | * Environment: production
test_1 | WARNING: Do not use the development server in a production environment.
test_1 | Use a production WSGI server instead.
test_1 | * Debug mode: off
test_1 | * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
test_1 | 192.168.0.1 - - [13/Jul/2018 03:53:08] "GET / HTTP/1.1" 200 -
用于Redash https://hub.docker.com/r/redash/redash/的Dockerhub链接
我在做什么错了?