Docker for MindsDB
MindsDB provides Docker images that facilitate running MinsdDB in Docker containers.
As MindsDB integrates with numerous data sources and AI frameworks, each integration requires a set of dependencies. Hence, MindsDB provides multiple Docker images for different tasks, as outlined below.
-
mindsdb/mindsdb:latest
(ormindsdb/mindsdb
) It is the lightweight Docker image of MindsDB that comes with these integrations preloaded. -
mindsdb/mindsdb:lightwood
It is the Docker image of MindsDB that comes with these integrations and the Lightwood integration preloaded. -
mindsdb/mindsdb:huggingface
It is the Docker image of MindsDB that comes with these integrations and the Hugging Face integration preloaded.
Prerequisites
Before proceeding, ensure you have installed Docker, following the official Docker documentation.
Setup
This setup of MindsDB uses one of the available Docker images, as listed above.
Follow the steps to set up MindsDB in a Docker container.
Install MindsDB
Run this command to create a Docker container with MindsDB:
Where:
docker run
is a native Docker command used to spin up a container.--name mindsdb_container
defines a name for the container.-p 47334:47334
publishes port 47334 to access MindsDB GUI and HTTP API.-p 47335:47335
publishes port 47335 to access MindsDB MySQL API.mindsdb/mindsdb
is a Docker image provided by MindsDB. You can choose a different one from the list above.
Once the container is created, you can use the following commands:
docker stop mindsdb_container
to stop the container. Note that this may not always be necessary because when turning off the host machine, the container will also be shut down.docker start mindsdb_container
to restart a stopped container with all its previous changes (such as any dependencies that were installed) intact. Note thatdocker start
restarts a stopped container, whiledocker run
creates a new container.
If you don’t want to follow the logs and get the prompt back, add the -d
flag that stands for detach.
If you want to persist your models and configurations in the host machine, run these commands:
Where -v $(pwd)/mdb_data:/root/mdb_storage
maps the newly created folder mdb_data
on the host machine to the /root/mdb_storage
inside the container.
Now you can access the MindsDB editor by going to 127.0.0.1:47334
in your browser.
If you experience any issues related to MKL or your training process does not complete, please add the MKL_SERVICE_FORCE_INTEL
environment variable, as below.
Install dependencies
MindsDB integrates with numerous data sources and AI frameworks. To use any of the integrations, you should enure that the required dependencies are installed in the Docker container.
Method 1
Install dependencies directly from MindsDB editor. Go to Settings and Manage Integrations, select integrations you want to use and click on Install.
Method 2
Start the MindsDB Docker container:
If you haven’t specified a container name when spinning up a container with docker run
, you can find it by running docker ps
.
If you haven’t yet created a container, use this command:
Start an interactive shell in the container:
Install the dependencies:
For example, run this command to install dependencies for the OpenAI handler:
Exit the interactive shell:
Restart the container:
Configuration
This is a configuration for MindsDB’s Docker image that includes storage location, log level, debugging information, installed integrations, and API endpoints. These parameters can be customized by modifying a JSON file that stores default configuration.
Default configuration
The default configuration for MindsDB’s Docker image is stored as a JSON code, as below.
Custom configuration
To override the default configuration, you can mount a config file over /root/mindsdb_config.json
, as below.
What’s next?
Now that you installed and started MindsDB locally in your Docker container, go ahead and find out how to create and train a model using the CREATE MODEL
statement.
Check out the Use Cases section to follow tutorials that cover Large Language Models, Chatbots, Time Series, Classification, and Regression models, Semantic Search, and more.