[GH-ISSUE #4818] config from env ignored in docker compose #65081

Closed
opened 2026-05-03 19:42:57 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @cam-narzt on GitHub (Jun 4, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4818

What is the issue?

I'm trying to configure ollama to run as a docker compose service as so:

#...
  ollama:
    container_name: ollama
    volumes:
    - ollama_data:/root/.ollama
    expose:
    - 11434:11434
    image: ollama/ollama
    tty: true
    environment:
      OLLAMA_HOST: '0.0.0.0'
      OLLAMA_ORIGINS: 'http://0.0.0.0:11434'
#...

But when ollama starts up, it prints the following:

ollama            | 2024/06/04 18:42:28 routes.go:1007: INFO server config env="map[OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_HOST: OLLAMA_KEEP_ALIVE: OLLAMA_LLM_LIBRARY: OLLAMA_MAX_LOADED_MODELS:1 OLLAMA_MAX_QUEUE:512 OLLAMA_MAX_VRAM:0 OLLAMA_MODELS: OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:1 OLLAMA_ORIGINS:[http://0.0.0.0:11434 http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:*] OLLAMA_RUNNERS_DIR: OLLAMA_TMPDIR:]"
ollama            | time=2024-06-04T18:42:28.081Z level=INFO source=images.go:729 msg="total blobs: 9"
ollama            | time=2024-06-04T18:42:28.090Z level=INFO source=images.go:736 msg="total unused blobs removed: 0"
ollama            | time=2024-06-04T18:42:28.091Z level=INFO source=routes.go:1053 msg="Listening on [::]:11434 (version 0.1.40)"
ollama            | time=2024-06-04T18:42:28.092Z level=INFO source=payload.go:30 msg="extracting embedded files" dir=/tmp/ollama3489097165/runners

The printed config shows both the OLLAMA_HOST and OLLAMA_ORIGINS don't match the config from the env vars; and indeed it is not listening to 0.0.0.0:11434 because other services running in the same docker network cannot access it on ollama:11434, but it does answer if I exec into the ollama service's container and access 127.0.0.1:11434.

OS

Docker

GPU

Other

CPU

Intel

Ollama version

0.1.40

Originally created by @cam-narzt on GitHub (Jun 4, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4818 ### What is the issue? I'm trying to configure ollama to run as a docker compose service as so: ```yaml #... ollama: container_name: ollama volumes: - ollama_data:/root/.ollama expose: - 11434:11434 image: ollama/ollama tty: true environment: OLLAMA_HOST: '0.0.0.0' OLLAMA_ORIGINS: 'http://0.0.0.0:11434' #... ``` But when ollama starts up, it prints the following: ``` ollama | 2024/06/04 18:42:28 routes.go:1007: INFO server config env="map[OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_HOST: OLLAMA_KEEP_ALIVE: OLLAMA_LLM_LIBRARY: OLLAMA_MAX_LOADED_MODELS:1 OLLAMA_MAX_QUEUE:512 OLLAMA_MAX_VRAM:0 OLLAMA_MODELS: OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:1 OLLAMA_ORIGINS:[http://0.0.0.0:11434 http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:*] OLLAMA_RUNNERS_DIR: OLLAMA_TMPDIR:]" ollama | time=2024-06-04T18:42:28.081Z level=INFO source=images.go:729 msg="total blobs: 9" ollama | time=2024-06-04T18:42:28.090Z level=INFO source=images.go:736 msg="total unused blobs removed: 0" ollama | time=2024-06-04T18:42:28.091Z level=INFO source=routes.go:1053 msg="Listening on [::]:11434 (version 0.1.40)" ollama | time=2024-06-04T18:42:28.092Z level=INFO source=payload.go:30 msg="extracting embedded files" dir=/tmp/ollama3489097165/runners ``` The printed config shows both the `OLLAMA_HOST` and `OLLAMA_ORIGINS` don't match the config from the env vars; and indeed it is not listening to `0.0.0.0:11434` because other services running in the same docker network cannot access it on `ollama:11434`, but it does answer if I exec into the ollama service's container and access `127.0.0.1:11434`. ### OS Docker ### GPU Other ### CPU Intel ### Ollama version 0.1.40
GiteaMirror added the bug label 2026-05-03 19:42:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#65081