This project demonstrates how to deploy a machine learning model using Docker containers and Azure Batch. The setup leverages Azure's scalable cloud resources to manage and execute Dockerized workloads efficiently. This is particularly useful for deploying models that require heavy computation, ensuring scalability and reliability.
Before starting, ensure you have the following:
- Azure Account: You'll need an active Azure subscription.
- Docker: Install Docker on your local machine here.
- Azure CLI: The Azure Command-Line Interface (CLI) is necessary for interacting with Azure services. Install it from here.
Or type
pip install azure-cli
on your terminal. - Git: Version control tool to clone this repository.
git clone https://github.com/jotap123/deploy-docker.git
cd deploy-docker
-
Login to Azure:
az login
-
Set up Azure Batch Account: Create a batch account and pool following the instructions in the Azure documentation here. Or create it via Terraform following the scripts on the "tf" folder.
-
Build Docker Image:
Navigate to the directory containing the Dockerfile and build the Docker image:
docker build -t my-ml-model .
Upload your Docker image to Azure Container Registry (ACR) or use Docker Hub, and then configure your Batch Pool to use this image.
- Submit a Job: Define your task and submit it to the Azure Batch pool. You can use the provided script or manually submit via the Azure portal.
- Monitor Jobs: Use the Azure portal or CLI to monitor job progress, logs, and outputs.
Once deployed, you can interact with your machine learning model by submitting tasks to the Azure Batch pool. The output and logs can be retrieved from Azure Storage or directly from the Batch interface.
- Docker Build Errors: Ensure your Dockerfile is correctly configured and all dependencies are installed.
- Azure Authentication Issues: Make sure you are logged in to Azure CLI and have the necessary permissions.
- Job Failures: Check the logs for errors in the task execution.
Contributions are welcome! Please fork the repository, create a new branch, and submit a pull request with your changes. Ensure your code follows the project's coding standards and includes appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.