This project demonstrates the development and deployment of a multi-container application using Docker. It involves developing a simple application with two containers: a MySQL database container and a machine learning (ML) model serving API container.
The task involves creating a custom multi-container application that consists of:
- Database Name:
Model_Logger
- Table:
Log
- Columns:
π ID
: Unique identifier for each log entry.π Current_Date_Time
: Timestamp of the log entry.π₯ Input_Params
: Input parameters for the ML model.π€ Output
: The output generated by the ML model.β±οΈ Response Time
: Time taken to process the input and generate the output.
- Columns:
-
This container runs a pre-trained ML model as a serving API.
-
The API accepts input, processes it with the ML model, generates an output, and then:
- π Logs the input parameters, output, and response time into the
Log
table in the MySQL database (running in a separate container). - π» Returns the result to the user.
Below is a screenshot of the application's interface:
- π Logs the input parameters, output, and response time into the
The interface allows users to input their height and weight, press the Predict button, and view the prediction result.
- A
docker-compose.yml
file is included to manage both containers. - With Docker Compose, you can easily start and stop the entire application.
- app: Contains the code for the ML model serving API.
- db-init-scripts: Contains SQL scripts to initialize the database, create the
Model_Logger
database, andLog
table. - docker-compose.yml: The Docker Compose file to run and manage both containers.
- Ensure that the ML model API is configured to connect to the MySQL database container for logging purposes.
- Verify that the MySQL container is properly initialized with the required database and table on startup.
- π³ Docker
- π¦ Docker Compose
- π₯ Clone the repository.
- πΎ Ensure Docker and Docker Compose are installed on your machine.
- π Run the application:
docker-compose up
- πStop the application:
docker-compose down