一、核对信息
必须保证
原始启动端口(server启动端口或者通过环境变量设置的端口)、
dockerfile expose的端口、
docker-compose.yml被映射的端口(如果不需要使用docker-compose.yml、请忽略)
三口一致
env、dockerfile、docker-compose 配置信息示例
我这里环境变量端口号是49070
FROM python:3.11-slim # Use an official Python runtime as a parent image
RUN apt-get update && apt-get install -y git # Install git
RUN pip install poetry==1.6.1 # Install poetry
RUN poetry config virtualenvs.create false # Disable virtualenvs
WORKDIR /code # Set the working directory to /code # Copy the current directory contents into the container at /code
COPY ./pyproject.toml ./requirements.txt ./README