docs/setup/self-hosted/docker.mdx
MindsDB provides Docker images that facilitate running MindsDB in Docker containers.
<Tip> 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 (or mindsdb/mindsdb)
It is the lightweight Docker image of MindsDB that comes with mysql,postgresql,snowflake,bigquery,mssql and salesforce pre-installed.
mindsdb/mindsdb:huggingface
It is the Docker image of MindsDB that comes with 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.
<Note> When running MindsDB in one container and the integration you want to connect to it (such as Ollama or PGVector) in another container, then use `http://host.docker.internal` instead of `localhost` when connecting this integration to MindsDB. </Note>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 \
-e MINDSDB_APIS=http,mysql \
-p 47334:47334 -p 47335:47335 \
mindsdb/mindsdb
Where:
docker run is a native Docker command used to spin up a container.--name mindsdb_container defines a name for the container.-e MINDSDB_APIS=http,mysql defines the APIs to be exposed by the MindsDB instance. All available APIs include http, mysql, and postgres.-p 47334:47334 -p 47335:47335 defines the ports where the APIs are exposed (HTTP and MySQL respectively).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 that docker start restarts a stopped container, while docker run creates a new container.docker run --name mindsdb_container -e MINDSDB_APIS=http -d -p 47334:47334 mindsdb/mindsdb
mkdir mdb_data
docker run --name mindsdb_container -e MINDSDB_APIS=http -p 47334:47334 -v $(pwd)/mdb_data:/root/mdb_storage mindsdb/mindsdb
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.
</Tip>
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 -e MINDSDB_APIS=http -p 47334:47334 mindsdb/mindsdb
docker run --name mindsdb_container -e MINDSDB_USERNAME='admin' -e MINDSDB_PASSWORD='password' -e MINDSDB_APIS=http -p 47334:47334 mindsdb/mindsdb
MindsDB integrates with numerous data sources and AI frameworks. To use any of the integrations, you should ensure 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.
<p align="center"> </p>Method 2
Start the MindsDB Docker container:
docker start mindsdb_container
docker run --name mindsdb_container -e MINDSDB_APIS=http -d -p 47334:47334 mindsdb/mindsdb
Start an interactive shell in the container:
docker exec -it mindsdb_container sh
Install 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:
exit
Restart the container:
docker restart mindsdb_container
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.
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
}
}
}
To override the default configuration, you can mount a config file created in your host machine over /root/mindsdb_config.json, as below.
docker run --name mindsdb_container -e MINDSDB_APIS=http -d -p 47334:47334 -v $(pwd)/mdb_config.json:/root/mindsdb_config.json mindsdb/mindsdb
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. </Tip>