If you’ve ever struggled to package your ML model in a custom Docker image for SageMaker, the new ml-container-creator tool is here to help. This friendly open-source wizard guides you through building a SageMaker-compatible container without all the usual Docker headaches. It’s like having an assistant that writes your Dockerfile, server code, and config files for you, so you can focus on your model. BYOC stands for Bring Your Own Container. In SageMaker, BYOC means you supply your own Docker image with everything needed to serve your ML model (the code, libraries, dependencies, etc.). AWS provides built-in containers for common frameworks (TensorFlow, PyTorch, etc.), but if you need a special setup (like a custom library or inference code), BYOC lets you use any Docker image. SageMaker will run your container on its managed infrastructure. For example, your container can include your favorite libraries and model file to handle predictions. The trade-off is that writing a BYOC image involves some boilerplate (like implementing the AWS’s ml-container-creator is a command-line tool (a Yeoman generator) that scaffolds a complete BYOC-style project for SageMaker. When you run it, it asks a few simple questions (like your project name and which ML framework you’re using) and then spits out a folder with all the files you need. This includes: A A A A Sample model and training code (optional) in a Test scripts ( A In short, it creates a lean, ready-to-go container project so you don’t start from scratch. It even supports popular ML frameworks out of the box – you can pick scikit-learn, XGBoost, TensorFlow, or an experimental Transformers option when running the generator. The generator will automatically add the right dependencies (e.g. Under the hood, ml-container-creator is powered by Yeoman, a project scaffolding tool. The generator has templates for all the files mentioned above, with placeholders that get filled in based on your answers. For example, if you select XGBoost, it injects the XGBoost library into A typical generated project might look like this: All these files are tailored based on your inputs. For instance, if you picked “sklearn” as the framework, the generator adds lines like One neat feature is that ml-container-creator includes a multi-layer test suite to ensure your container works before going live. The generator can set up tests at four levels: The ml-container-creator test suite checks your model step-by-step from raw code to a live SageMaker endpoint. First, there’s a model test: it trains or loads your model and runs a sample inference in plain Python to make sure the model itself works. Second, there’s a handler test: it runs your If all these tests pass, you can be confident your BYOC image is set up right. As the AWS blog notes, if “all of these tests pass, you have successfully deployed a container to a SageMaker endpoint using the BYOC paradigm”. This built-in test suite is a great safety net for catching issues early. No More Boilerplate: The biggest win is you don’t have to hand-write all the boilerplate (server code, health checks, config files). The tool generates them for you. Beginner-Friendly: If you’re new to SageMaker BYOC, the guided prompts and templates mean you can “start hosting [your] models immediately”, without studying all of SageMaker’s container requirements. Customizable Yet Lean: You get a lean container that only includes what you choose. You can always tweak the generated files (it’s open-source) to fit special needs. Multi-Framework Support: It works with several ML frameworks. At launch it supports scikit-learn, XGBoost, TensorFlow, and an experimental Transformers option, with more planned later. Built-in Testing & Deployment: As mentioned, it gives you test scripts and even a Open Source & Community: It’s an open-source project on GitHub, so you can inspect the code, suggest features, or contribute fixes. It’s designed to let you focus on your ML model rather than Docker details. In short, ml-container-creator streamlines the BYOC process. It frees you up to focus on the core ML work (the model and data) instead of low-level container setup. As the AWS team puts it, this tool empowers both new and experienced users to rapidly bring models to production by handling the container scaffolding for them. Ready to try it? Here’s a quick start: you need Node.js (for Yeoman) and Docker installed. Then run: Clone and install: This sets up the generator on your system. Run the generator: Follow the prompts (project name, framework, whether to include tests or sample code, etc.). Inspect the output: Build and deploy: That’s it – instead of writing all these files yourself, ml-container-creator does the heavy lifting. It’s a fast way to get a BYOC endpoint up and running on SageMaker. AWS’s ml-container-creator is a cool new tool that makes Bring Your Own Container on SageMaker painless. It’s like having a guide through the murky process of containerization: you answer a few questions and it generates a SageMaker-ready container project for you. This saves you from boilerplate and lets you focus on your model. Whether you’re an ML newbie or a seasoned dev, ml-container-creator empowers you to deploy models faster and with confidence. Check out the GitHub repo and give it a whirl – your next SageMaker container could be just a few prompts away!
What is BYOC on SageMaker?
/ping health-check endpoint and other SageMaker requirements). As the AWS blog explains, ml-container-creator generates this boilerplate so you don’t have to worry about it. This means your ML team can focus on improving the model itself, instead of wrestling with Docker setup.Introducing AWS’s ml-container-creator
serve.py or start_server.py script (Flask or FastAPI) to handle incoming requests.model_handler.py to load and run your model.Dockerfile and nginx.conf to define the container environment.requirements.txt filled with just the Python packages you need for your chosen framework.sample_model/ folder.test_model_handler.py, test_local_image.sh, etc.) to verify everything works.deploy.sh script to push the container to AWS and deploy a SageMaker endpoint.xgboost or scikit-learn and joblib) into your requirements.txt based on that choice.How ml-container-creator Works (Behind the Scenes)
requirements.txt; if you select scikit-learn, it injects scikit-learn and joblib instead. It also asks whether you want sample code for a quick demo (using an example “Abalone” dataset). If you agree, it adds example training and inference scripts; if not, it only keeps what’s needed to deploy your own model.scikit-learn==1.7.1 and joblib==1.4.2 to requirements.txt; if you picked XGBoost, it adds xgboost==2.1.3 instead. This makes the final container image lean (only your needed libraries) and ready to run on SageMaker.Testing Your Container
model_handler.py code (with the model loaded) to confirm it can perform an inference as it would inside the container. Third, there’s a container test: this actually builds the Docker image locally, starts the Flask/FastAPI server, and sends a request to the /invocations endpoint on port 8080 to verify the container runs correctly. Finally, there’s an endpoint test (if you provide a SageMaker endpoint name): the tool deploys the container to AWS and sends a real HTTP request to your SageMaker endpoint to confirm end-to-end functionality.Benefits of Using ml-container-creator
deploy.sh so you can quickly build your image, push to ECR, and deploy a SageMaker endpoint. The generator even sets up your AWS region, image name, and SageMaker endpoint names in those scripts for you (usually in us-east-1 by default).Getting Started
yo ml-container-creator
The tool will create a new folder (named after your project and timestamp) with all the files. For example, a Dockerfile, serve.py, requirements.txt, nginx.conf, and the deploy/build_and_push.sh script. You can customize these if needed (for example, change the AWS region or instance type in build_and_push.sh).
You can run the included tests (test_local_image.sh) to build your container and test it locally. When you’re ready, use the deploy.sh script to build the image, push to ECR, and create/update a SageMaker endpoint. The blog shows that the scripts set up AWS region, account, and SageMaker endpoint names for you. After that, hit the endpoint with data to make predictions!In Summary
References
Bring Your Own Container Made Easy: Introducing AWS ml-container-creator
AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!
Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!
View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE coursesOur Community
~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.














