[GH-ISSUE #3151] [BUG]: LLM_PROVIDER doesn't work on .env docker compose #2021

Closed
opened 2026-02-22 18:27:47 -05:00 by yindo · 1 comment
Owner

Originally created by @GeuntaBuwono on GitHub (Feb 8, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3151

How are you running AnythingLLM?

Docker (local)

What happened?

I've been running on docker-compose.

whenever I change LLM_PROVIDER on .env and restart the docker-compose, it returns to OLLAMA, when I open the webpage config /settings/llm-preference.

here's .env config

# Auto-dump ENV from system call on 12:50:57 GMT+0000 (Coordinated Universal Time)
LLM_PROVIDER='openrouter'
EMBEDDING_MODEL_PREF='nomic-embed-text:latest'
OLLAMA_BASE_PATH='http://127.0.0.1:11434'
OLLAMA_MODEL_PREF='llama2'
OLLAMA_MODEL_TOKEN_LIMIT='4096'
EMBEDDING_ENGINE='ollama'
EMBEDDING_BASE_PATH='http://127.0.0.1:11434'
EMBEDDING_MODEL_MAX_CHUNK_LENGTH='8192'
VECTOR_DB='lancedb'
...

here's my docker-compose.yml

name: anythingllm

networks:
  anything-llm:
    driver: bridge

services:
  anythingllm:
    image: mintplexlabs/anythingllm
    container_name: anythingllm
    build:
      context: ../.
      dockerfile: ./docker/Dockerfile
      args:
        ARG_UID: ${UID:-1000}
        ARG_GID: ${GID:-1000}
    cap_add:
      - SYS_ADMIN
    volumes:
      - "./.env:/app/server/.env"
      - anythingllm_storage:/app/server/storage
    user: "${UID:-1000}:${GID:-1000}"
    ports:
      - "3010:3001"
    env_file:
      - .env
    networks:
      - anything-llm
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: always
volumes:
  anythingllm_storage:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ./

Are there known steps to reproduce?

No response

Originally created by @GeuntaBuwono on GitHub (Feb 8, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3151 ### How are you running AnythingLLM? Docker (local) ### What happened? I've been running on docker-compose. whenever I change `LLM_PROVIDER` on .env and restart the docker-compose, it returns to OLLAMA, when I open the webpage config `/settings/llm-preference`. here's .env config ``` # Auto-dump ENV from system call on 12:50:57 GMT+0000 (Coordinated Universal Time) LLM_PROVIDER='openrouter' EMBEDDING_MODEL_PREF='nomic-embed-text:latest' OLLAMA_BASE_PATH='http://127.0.0.1:11434' OLLAMA_MODEL_PREF='llama2' OLLAMA_MODEL_TOKEN_LIMIT='4096' EMBEDDING_ENGINE='ollama' EMBEDDING_BASE_PATH='http://127.0.0.1:11434' EMBEDDING_MODEL_MAX_CHUNK_LENGTH='8192' VECTOR_DB='lancedb' ... ``` here's my docker-compose.yml ``` name: anythingllm networks: anything-llm: driver: bridge services: anythingllm: image: mintplexlabs/anythingllm container_name: anythingllm build: context: ../. dockerfile: ./docker/Dockerfile args: ARG_UID: ${UID:-1000} ARG_GID: ${GID:-1000} cap_add: - SYS_ADMIN volumes: - "./.env:/app/server/.env" - anythingllm_storage:/app/server/storage user: "${UID:-1000}:${GID:-1000}" ports: - "3010:3001" env_file: - .env networks: - anything-llm extra_hosts: - "host.docker.internal:host-gateway" restart: always volumes: anythingllm_storage: driver: local driver_opts: type: none o: bind device: ./ ``` ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:27:47 -05:00
yindo closed this issue 2026-02-22 18:27:47 -05:00
Author
Owner

@timothycarambat commented on GitHub (Feb 8, 2025):

You have the env file binded to the app/server/.env which is correct but also

env_file:
- .env

You only need the binded mount, not the env_file too. Second, there is something else going on with env collision since the default fallback LLM_PROVIDER if your env file was not being read would be None on that screen.

So there is some env collision on your end and removing the env_file YAML block should resolve that. We dont fallback or assume ollama as the LLM provider in the code

@timothycarambat commented on GitHub (Feb 8, 2025): You have the env file binded to the `app/server/.env` which is correct but also > env_file: - .env You only need the binded mount, not the `env_file` too. Second, there is something else going on with env collision since the default fallback `LLM_PROVIDER` if your env file was not being read would be `None` on that screen. So there is some env collision on your end and removing the env_file YAML block should resolve that. We dont fallback or assume ollama as the LLM provider in the code
yindo changed title from [BUG]: LLM_PROVIDER doesn't work on .env docker compose to [GH-ISSUE #3151] [BUG]: LLM_PROVIDER doesn't work on .env docker compose 2026-06-05 14:44:04 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2021