Install Chroma Inside Docker Container on Linux

Install Chroma Inside Docker Container on Linux

Chroma is a vector database designed for storing and querying embeddings efficiently, commonly used in AI and machine learning applications.

This tutorial explains how to install Chroma inside a Docker container on Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install Chroma

  • Host network

Run the following command to create a container for Chroma that uses host network:

docker run -d --name=chroma --restart=always --network=host \
    -v /opt/chroma/data:/chroma/chroma \
    -e IS_PERSISTENT=TRUE \
    chromadb/chroma
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, Chroma service is listening on port 8000. It can be changed with -p option.

docker network create app-net
docker run -d --name=chroma --restart=always --network=app-net \
    -p 8080:8000 \
    -v /opt/chroma/data:/chroma/chroma \
    -e IS_PERSISTENT=TRUE \
    chromadb/chroma

Testing Chroma

Send a GET request to verify the accessibility of the Chroma service:

curl http://<IP_ADDRESS>:8000/api/v1/heartbeat

Note: Replace <IP_ADDRESS> with the system's actual IP address.

Uninstall Chroma

To completely remove Chroma, remove its container:

docker rm --force chroma

Remove Chroma image:

docker rmi chromadb/chroma

You can also remove Chroma data:

sudo rm -rf /opt/chroma

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.