LibreChat/docs/install/configuration/docker_override.md
Fuegovic 51050cc4d3
🧹📚 docs: refactor and clean up (#1392)
* 📑 update mkdocs

* rename docker override file and add to gitignore

* update .env.example - GOOGLE_MODELS

* update index.md

* doc refactor: split installation and configuration in two sub-folders

* doc update: installation guides

* doc update: configuration guides

* doc: new docker override guide

* doc: new beginner's guide for contributions - Thanks @Berry-13

* doc: update documentation_guidelines.md

* doc: update testing.md

* doc: update deployment guides

* doc: update /dev readme

* doc: update general_info

* doc: add 0 value to doc weight

* doc: add index.md to every doc folders

* doc: add weight to index.md and move openrouter from free_ai_apis.md to ai_setup.md

* doc: update toc so they display properly on the right had side in mkdocs

* doc: update pandoranext.md

* doc: index logging_system.md

* doc: update readme.md

* doc: update litellm.md

* doc: update ./dev/readme.md

* doc:🔖 new presets.md

* doc: minor corrections

* doc update: user_auth_system.md and presets.md, doc feat: add mermaid support to mkdocs

* doc update: add screenshots to presets.md

* doc update: add screenshots to - OpenID with AWS Cognito

* doc update: BingAI cookie instruction

* doc update: discord auth

* doc update: facebook auth

* doc: corrections to user_auth_system.md

* doc update: github auth

* doc update: google auth

* doc update: auth clean up

* doc organization: installation

* doc organization: configuration

* doc organization: features+plugins & update:plugins screenshots

* doc organization: deploymend + general_info  & update: tech_stack.md

* doc organization: contributions

* doc: minor fixes

* doc: minor fixes
2023-12-22 08:36:42 -05:00

3.3 KiB

title weight
🐋 Docker Compose Override -9

How to Use the Docker Compose Override File

In Docker Compose, an override file is a powerful feature that allows you to modify the default configuration provided by the main docker-compose.yml without the need to directly edit or duplicate the whole file. The primary use of the override file is for local development customizations, and Docker Compose merges the configurations of the docker-compose.yml and the docker-compose.override.yml files when you run docker-compose up.

Here's a quick guide on how to use the docker-compose.override.yml:

Note: Please consult the docker-compose.override.yml.example for more examples

See the the official docker documentation for more info:

Step 1: Create a docker-compose.override.yml file

If you don't already have a docker-compose.override.yml file, you can create one by copying the example override content:

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

This file will be picked up by Docker Compose automatically when you run docker-compose commands.

Step 2: Edit the override file

Open your docker-compose.override.yml file with vscode or any text editor.

Make your desired changes by uncommenting the relevant sections and customizing them as needed.

For example, if you want to use a prebuilt image for the api service and expose MongoDB's port, your docker-compose.override.yml might look like this:

version: '3.4'

services:
  api:
    image: ghcr.io/danny-avila/librechat:latest

  mongodb:
    ports:
      - 27018:27017

Note: Be cautious with exposing ports like MongoDB to the public, as it can make your database vulnerable to attacks.

Step 3: Apply the changes

To apply your configuration changes, simply run Docker Compose as usual. Docker Compose automatically takes into account both the docker-compose.yml and the docker-compose.override.yml files:

docker-compose up -d

If you want to invoke a build with the changes before starting containers:

docker-compose build
docker-compose up -d

Step 4: Verify the changes

After starting your services with the modified configuration, you can verify that the changes have been applied using the docker ps command to list the running containers and their properties, such as ports.

Important Considerations

  • Order of Precedence: Values defined in the override file take precedence over those specified in the original docker-compose.yml file.
  • Security: When customizing ports and publicly exposing services, always be conscious of the security implications. Avoid using defaults for production or sensitive environments.

By following these steps and considerations, you can easily and safely modify your Docker Compose configuration without altering the original docker-compose.yml file, making it simpler to manage and maintain different environments or local customizations.