Chanafot
Chanafot

Reputation: 796

machine learning python app in docker with anaconda for k8s

There is a python app for machine lerning that developer have running in docker. Azure container instance in particular. They are using micromamba:0.15.3 and inside dockerfile they also install nginx for web server. Docker file at the end will run: CMD ["./start.sh"]

and script inside:

service nginx start 
streamlit run app.py --theme.base "dark" --server.address localhost --server.port 5000  --server.enableCORS=false

Also I saw that they use anaconda locally to run web app. This also runs streamlit

Now I would get rid of nginx part in dockerfile since will be moving to k8s and will be using nginx ingress controller + ingres as vhost which will be pointin to the running python service

Which is the Docker image that I should use for this? what the difference between using conda, miniconda or python official image? Don´t I just need python image where you can add streamlit, like here?

https://hub.docker.com/r/mambaorg/micromamba

https://hub.docker.com/_/python

Upvotes: 0

Views: 219

Answers (2)

pooja
pooja

Reputation: 1

Python Official Image: Minimal, suitable if you only need Python and a few packages. Most straightforward.

Miniconda: Lightweight Conda environment, good for managing dependencies and environments without the full Anaconda distribution.

Anaconda: Comprehensive, includes a lot of scientific packages. Heavier and may be overkill if you only need a few packages.

Given your need to run streamlit in a Kubernetes setup, starting with the Python Official Image is a good choice for simplicity and efficiency. If you need more complex dependency management, then Miniconda would be the next step up.

Upvotes: 0

Pierre
Pierre

Reputation: 1943

You are right, you can create a simple Dockerized App derived from an official Python Image, Create a virtual environment and install a requirements.txt file in the build stage into the environment for streamlit and other dependencies. Anaconda and Miniconda just wrap the management of python virtual environments. If there is an environment.yml instead of requirements.txt you can use conda create -f environment.yml to create the environment in your Docker Container.

Upvotes: 1

Related Questions