Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

Docker Override

Use a docker-compose.override.yml file to customize LibreChat's Docker setup without editing the main docker-compose.yml.

A Docker Compose override file lets you change the default configuration in docker-compose.yml without editing or duplicating it. Override files are mainly for local customizations. When you run docker compose up, Compose merges docker-compose.yml with docker-compose.override.yml automatically.

More examples

See docker-compose.override.yml.example in the repository for a fuller set of override snippets you can copy from.

Configure the Override

Create the override file. If you don't already have one, copy the example. Docker Compose picks it up automatically when you run docker compose commands.

cp docker-compose.override.yml.example docker-compose.override.yml

Edit the override file. Open docker-compose.override.yml in your editor, then uncomment and customize the sections you need.

One entry per service

Each service name (api, mongodb, meilisearch, ...) can appear only once. To override multiple settings on a single service, combine them under that one entry.

Apply the changes. Run Docker Compose as usual. It merges docker-compose.yml and docker-compose.override.yml for you.

docker compose up -d

Verify the changes. List the running containers and their properties, such as ports, to confirm your overrides took effect.

docker ps

Examples

To mount your librechat.yaml config file so Docker can use it for Custom Endpoints & Configuration:

services:
  api:
    volumes:
      - ./librechat.yaml:/app/librechat.yaml

To build the api image locally, mount the config file, and use an older MongoDB that doesn't require AVX support:

services:
  api:
    volumes:
      - ./librechat.yaml:/app/librechat.yaml
    image: librechat
    build:
      context: .
      target: node

  mongodb:
    image: mongo:4.4.18

Watch exposed ports

Exposing MongoDB or Meilisearch ports to the public can leave your data vulnerable. Avoid default ports for production or sensitive environments.

Using deploy-compose.yml

With a non-default Compose file such as deploy-compose.yml, the override is not loaded automatically. Pass both files explicitly with -f (or --file); settings in later files override or add to earlier ones.

The override file can have any name, though you may already have docker-compose.override.yml in place. Run commands like so:

docker compose -f deploy-compose.yml -f docker-compose.override.yml pull
docker compose -f deploy-compose.yml -f docker-compose.override.yml up

Reference

  • Order of precedence: values in the override file take precedence over the same values in docker-compose.yml.
  • Security: when customizing ports and exposing services publicly, be conscious of the security implications and avoid defaults for production.

For more detail, see the official Docker documentation:

How is this guide?