Skip to content

CLI deploy writes to host ./models/ but compose mounts a named volume — deployed models are never served #3

@atkaridarshan04

Description

@atkaridarshan04

What happened?

Running inference-engine deploy ./sentiment.pkl writes the generated pipeline definition and artifact to the host filesystem:

models/sentiment/v1/definition.py
models/sentiment/v1/sentiment.pkl

But docker-compose.yml mounts the models directory as a named Docker volume, not a bind-mount:

# api and worker both have:
volumes:
  - models:/app/models

A named volume is managed by Docker's storage backend — it is not the host's ./models/ directory. The container never sees what the CLI wrote. The model cannot be served. Calling POST /admin/models/sentiment/v1/reload returns 404 because the definition file does not exist inside the container.

Additionally, models/ is not in .gitignore, so artifact files (including large .pkl/.onnx binaries) can be accidentally committed.

Steps to reproduce

  1. Start the full stack: bash dev.sh
  2. Deploy a model: inference-engine deploy ./sentiment.pkl --name sentiment --version v1 --sample-input "great"
  3. Attempt hot-reload: curl -X POST http://localhost:8000/admin/models/sentiment/v1/reload -H "X-API-Key: admin-key"
  4. Attempt inference: curl -X POST http://localhost:8000/predict -H "X-API-Key: dev-key" -d '{"model":"sentiment","version":"v1","data":"great"}'

Both step 3 and step 4 return 404 — the model does not exist inside the container.

Expected behavior

After inference-engine deploy, the deployed model is immediately available to the running container. POST /admin/models/<name>/<version>/reload returns 200 and subsequent /predict calls succeed — no container restart, no manual file copy.

Environment

  • Affects all OS where Docker Compose is used
  • Python version: 3.12+
  • Inference Engine version/commit: current main
  • Execution backend: any (the bug is at the volume layer, not the executor)

Relevant logs or error output

# POST /admin/models/sentiment/v1/reload
HTTP 404  {"detail": "Model not found: sentiment v1"}

# The file exists on the host but not in the container:
$ ls models/sentiment/v1/
definition.py  sentiment.pkl

$ docker compose exec api ls /app/models/
(empty — named volume has no files)

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions