Can't call python web service on local container

I am running a Flask app on port 5000 within a Docker container.

If I call the web service from within the container, it responds. If I call the web service from Postman on my laptop, where the container is running, I get

POST http://127.0.0.1:5000/predict
Error: socket hang up ←

I do have port 5000 open – If I run

docker ps

I see

888f4ebc15f9 hh_regression_app “python hh_regressio…” 32 minutes ago Up 32 minutes 0.0.0.0:5000->5000/tcp busy_chaplygin

I think this part means I have the port open right? “0.0.0.0:5000->5000/tcp”

Another interesting thing to note – I installed tcpdumb onto the container and listened on port 5000

The container knows I’m trying to talk to it. It sees my incoming requests. It just won’t do anything w them – I just always get a “go away” kind of error – From Python it looks like this:

ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))

Is this some kind of permissions thing? Is there anyway for me to tell? Or, instead of jumping to conclusions, does anyone know what is going on here/how to fix? Thank You!!

Also, here is the Dockerfile I build the image from in case useful! I am a Docker newb, so Entirely possible I’m making some kind of beginner’s mistake here:

# Use the official Python image as the base image
FROM python:3.11-slim-bookworm

# Set the working directory in the container
WORKDIR /app

# Install system-level dependencies for building NumPy
RUN apt-get update && apt-get install -y build-essential

# Copy your Python application script to the container
COPY hh_regression_model_app.py /app/hh_regression_model_app.py
COPY regression_model.pkl /app/regression_model.pkl

# Copy a requirements file containing the list of libraries to install
COPY requirements.txt /app/requirements.txt

# Install the libraries from requirements.txt
RUN pip install -r requirements.txt

# Define the command to run your Python application
CMD [“python”, “hh_regression_model_app.py”]