Intro to Docker
This tutorial introduces containers via teaching how to use docker. This part is not designed for HPC but understanding the idea of a container is important.
Last updated
This tutorial introduces containers via teaching how to use docker. This part is not designed for HPC but understanding the idea of a container is important.
Last updated
If you understand docker then skip to .
Docker is a tool that packages applications and their dependencies into containers, ensuring they run the same way on any system. It's useful because it:
Ensures Consistency across different environments (e.g., development, testing, production).
Isolates Applications, preventing conflicts and improving security.
Makes Deployment Easy by packaging everything needed to run an app in one container.
Increases Efficiency since containers are lightweight and use less resources compared to traditional virtual machines.
In short, Docker simplifies running and deploying applications by making them portable and consistent.
The dockerfile tells docker how to setup the containner:
Build the Docker Image:
This will print the model's accuracy and the prediction for the sample flower measurements in your terminal.
Log In to Docker Hub: needs https://hub.docker.com/account
Tag and Push the Image: (change username to your docker hub account username)
Pull the Docker Image:
This command downloads the Docker image dukeieee/ml-app
from Docker Hub to your local system or VM. The image contains the Python ML app and its required dependencies.
Run the Docker Container:
This command starts a container using the downloaded image. The app will train a machine learning model on the iris dataset and print the model's accuracy and predictions directly to your terminal.
This approach ensures that the app runs with all necessary dependencies, regardless of the environment, providing a consistent and reproducible setup.
In a local terminal that has the directory with ml_app.py open: (This may need logging into docker with docker login and using a account)
You can follow to connect to a jetstream 2 vm