| title | Docker for MindsDB |
|---|---|
| sidebarTitle | Docker |
MindsDB provides Docker images that facilitate running MindsDB in Docker containers.
As MindsDB integrates with numerous [data sources](/integrations/data-overview) and [AI frameworks](/integrations/ai-overview), 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:lightwoodIt is the Docker image of MindsDB that comes with these integrations and the Lightwood integration preloaded. -
mindsdb/mindsdb:huggingfaceIt is the Docker image of MindsDB that comes with these integrations and the Hugging Face integration preloaded.
Before proceeding, ensure you have installed Docker, following the official Docker documentation.
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.
Run this command to create a Docker container with MindsDB:
docker run --name mindsdb_container \
-p 47334:47334 -p 47335:47335 mindsdb/mindsdbWhere:
docker runis a native Docker command used to spin up a container.--name mindsdb_containerdefines a name for the container.-p 47334:47334publishes port 47334 to access MindsDB GUI and HTTP API.-p 47335:47335publishes port 47335 to access MindsDB MySQL API. This is optional and can be omitted if you don't need to use the MySQL API.mindsdb/mindsdbis a Docker image provided by MindsDB. You can choose a different one from the list above.
docker run -e MINDSDB_APIS="http,mysql,mongodb,postgres" \
-p 47334:47334 -p 47335:47335 -p 47336:47336 -p 55432:55432 mindsdb/mindsdbYou can find more information on the environment variables supported by MindsDB here
Once the container is created, you can use the following commands:
docker stop mindsdb_containerto 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_containerto restart a stopped container with all its previous changes (such as any dependencies that were installed) intact. Note thatdocker startrestarts a stopped container, whiledocker runcreates a new container.
docker run --name mindsdb_container \
-d -p 47334:47334 mindsdb/mindsdbmkdir mdb_data
docker run --name mindsdb_container \
-p 47334:47334 -v $(pwd)/mdb_data:/root/mdb_storage mindsdb/mindsdbWhere -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.
docker run --name mindsdb_container -e MKL_SERVICE_FORCE_INTEL=1 \
-p 47334:47334 mindsdb/mindsdbdocker run --name mindsdb_container \
-e MINDSDB_USERNAME='admin' -e MINDSDB_PASSWORD='password' \
-p 47334:47334 mindsdb/mindsdbMindsDB 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:
docker start mindsdb_containerdocker run --name mindsdb_container \
-d -p 47334:47334 mindsdb/mindsdbStart an interactive shell in the container:
docker exec -it mindsdb_container shInstall the dependencies:
pip install .[handler_name]For example, run this command to install dependencies for the OpenAI handler:
pip install .[openai]Exit the interactive shell:
exitRestart the container:
docker restart mindsdb_containerThis 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.
The default configuration for MindsDB's Docker image is stored as a JSON code, as below.
{
"config_version":"1.4",
"paths": {
"root": "/root/mdb_storage"
},
"debug": false,
"integrations": {},
"api": {
"http": {
"host": "0.0.0.0",
"port": "47334"
},
"mysql": {
"host": "0.0.0.0",
"password": "",
"port": "47335",
"user": "mindsdb",
"database": "mindsdb",
"ssl": true
},
"mongodb": {
"host": "0.0.0.0",
"port": "47336",
"database": "mindsdb"
}
}
}To override the default configuration, you can mount a config file over /root/mindsdb_config.json, as below.
docker run --name mindsdb_container -d -p 47334:47334 \
-v mdb_config.json:/root/mindsdb_config.json mindsdb/mindsdbNow 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.

