Fixed: An MLflow Model Container Answers 404 for /health and /version
A model container built with mlflow models build-docker answered /ping and /invocations, but /health and /version answered HTTP/1.1 404 Not Found with a body of {}. MLflow's guide lists /health as the same as /ping, and both work with mlflow models serve. In the image, nginx sits in front of the model server and forwards only /ping and /invocations. The fix is to health-check the container with /ping.
What I Was Doing
In Part 9 of the MLflow series, I served the shopper project's champion model with mlflow models serve first, where all four endpoints from MLflow's guide answered, and then in a Docker image built with mlflow models build-docker (MLflow 3.18.0). The guide to deploying a model locally lists them:
- /invocations: An inference endpoint that accepts POST requests with input data and returns predictions.
- /ping: Used for health checks.
- /health: Same as /ping
- /version: Returns the MLflow version.
I started the container with its port 8080 published on my computer's port 5001:
docker run -d --name shopper-api --platform linux/amd64 -e MLFLOW_MODELS_WORKERS=2 -p 127.0.0.1:5001:8080 shopper-purchase-prediction:2
Then I asked it for /health, to use it as the container's health check.
What I Expected
200 OK, as from mlflow models serve.
What I Got
curl -i http://127.0.0.1:5001/health
HTTP/1.1 404 Not Found
Server: nginx/1.26.3
Date: Thu, 26 Nov 2026 05:21:27 GMT
Content-Type: application/octet-stream
Content-Length: 2
Connection: keep-alive
{}

/version gave the same 404 and {}.
What I Checked
Who answered. Server: nginx/1.26.3. With mlflow models serve the answers say server: uvicorn, the model server itself, so in the container something else is in front of it.
What that nginx forwards. The image runs nginx with a configuration file from MLflow. I printed its location blocks from inside the running container:
docker exec shopper-api grep -n -A1 'location' /usr/local/lib/python3.15/site-packages/mlflow/models/container/scoring_server/nginx.conf
27: location ~ ^/(ping|invocations) {
28- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
--
35: location / {
36- return 404 "{}";
Only paths that start with /ping or /invocations go on to the model server. Everything else, /health and /version included, gets nginx's own 404 with {}.
Why It Happens
mlflow models serve runs the model server, uvicorn, directly, so every endpoint it has answers. An image from mlflow models build-docker starts nginx on port 8080 in front of uvicorn, and MLflow's nginx.conf passes on only /ping and /invocations. The guide describes the model server's endpoints, not what the container lets through.
The Fix
Health-check the container with /ping, which nginx forwards:
curl -i http://127.0.0.1:5001/ping
After the Fix
HTTP/1.1 200 OK
Server: nginx/1.26.3
Date: Thu, 26 Nov 2026 05:21:29 GMT
Content-Type: application/json
Content-Length: 1
Connection: keep-alive

200 OK from the same container: nginx passed /ping to the model server, which answered that the model is loaded.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
A container health check on /health | Always 404, so the container looks unhealthy | Check /ping |
Reading the MLflow version from /version in the container | 404 and {} | Use /version with mlflow models serve; the image's Dockerfile installs mlflow==3.18.0 |
Turning nginx off to reach /health | With DISABLE_NGINX=true alone, nothing answers from outside | Fixed: curl: (52) Empty reply from server with DISABLE_NGINX |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
/ping answers 502 Bad Gateway right after docker run | nginx is up but the model server is still starting | Wait a few seconds and try again |
curl: (52) Empty reply from server right after docker run | The container is starting and nginx isn't listening yet | Wait a few seconds and try again |
FAQ
Why does the image use nginx at all?
MLflow's container starts nginx and uvicorn together, as the build-docker reference notes: "by default, the container will start nginx and uvicorn processes". nginx is what listens on port 8080.
Does /ping check the model?
The model server answers /ping with 200 once it has loaded the model, which is what a health check needs.
Conclusion
In an MLflow model image, nginx listens on port 8080 and forwards only /ping and /invocations to the model server, so /health and /version, which work with mlflow models serve, answer 404 {}. Health-checking the container with /ping gave 200 OK.
Additional Resources
- Deploy MLflow Model as a Local Inference Server — the endpoints of the model server.
- mlflow models build-docker — the image, nginx and uvicorn.
- nginx location — how nginx matches request paths.
