Build a Bento and Containerize It
Bundle code, model, and deps into a deployable Bento.
Build a Bento and Containerize It is a free MLOps Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MLOps Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What a Bento Is
A Bento is the deployable bundle BentoML builds. It packs your service code, the model, and the exact dependencies into one archive. 📦
The bentofile
You describe the build in a bentofile.yaml. It names the service entry point and lists what to include.
service: "service:svc"Include Your Files
You tell BentoML which source files to bundle. The include key takes globs so only the code you need ships.
include:
- "*.py"Pin Python Packages
Dependencies live right in the bentofile. Under python you list packages so the build resolves them into the bundle.
python:
packages:
- scikit-learnBuild the Bento
One command assembles everything. bentoml build reads the bentofile and produces a versioned Bento in your store.
bentoml buildList Your Bentos
Built Bentos show up alongside your models. Run bentoml list to see each one with its name and version tag.
bentoml listWhy Containerize
A Bento still needs a runtime. Turning it into a Docker image makes it run identically on any machine or cloud. 🐳
One Command to an Image
BentoML writes the Dockerfile for you. bentoml containerize takes a Bento tag and builds a ready-to-run image.
bentoml containerize iris_classifier:latestRun the Container
Now it is a normal image. You start it with docker run, mapping the port so requests reach the service inside.
docker run -p 3000:3000 iris_classifier:latestShip It Anywhere
That image is your deployable artifact. Push it to a registry and any cloud runtime or Kubernetes cluster can pull and serve it. 🚀
Set a Docker Base Image
You can control the runtime under your image. The docker section of the bentofile lets you pick a Python version or base.
docker:
python_version: "3.11"Quick Check
You ran bentoml build and got a Bento. What does bentoml containerize add on top of that?
Recap
You defined a bentofile, ran bentoml build to bundle code and deps, then containerized it into a Docker image ready to ship to any cloud. End to end! 🙌
Frequently asked questions
Is the “Build a Bento and Containerize It” lesson free?
Yes — the full text of “Build a Bento and Containerize It” is free to read here on the web, and the MLOps Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MLOps Academy course, upgrade to CoddyKit PRO.
What will I learn in “Build a Bento and Containerize It”?
Bundle code, model, and deps into a deployable Bento. You practise MLOps Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start MLOps Academy?
No prior experience is required. MLOps Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Build a Bento and Containerize It” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this MLOps Academy lesson?
Yes. Every MLOps Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Save a Model to the Bento Store
- Define a Service and Its API
- Enable Adaptive Micro-Batching
- Build a Bento and Containerize It