容器内的应用程序无法从外部访问,即如果我执行到 docker 容器并执行
curl localhost:5000
Run Code Online (Sandbox Code Playgroud)
它工作正常,但不能在我电脑的浏览器上运行我收到错误:无法访问此站点
我的 Dockerfile:
# Use an official Python runtime as a parent image
FROM python:3.7-slim
# Set the working directory to /app
WORKDIR /web-engine
# Copy the current directory contents into the container at /app
COPY . /web-engine
# Install Gunicorn3
RUN apt-get update && apt-get install default-libmysqlclient-dev gcc -y
# Install any needed packages specified in requirements.txt
RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
# Make port 5000 available to the world outside this …Run Code Online (Sandbox Code Playgroud)