[GH-ISSUE #1206] [Docs]: Docker - how to use non-default port #747

Closed
opened 2026-02-22 18:21:09 -05:00 by yindo · 6 comments
Owner

Originally created by @chrisbennight on GitHub (Apr 27, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1206

How are you running AnythingLLM?

Docker (local)

What happened?

Docker healthcheck fails when setting alternate SERVER_PORT in .env

this line: https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/docker-healthcheck.sh#L4

should be updated and the hardcoded 3001 replaced with SERVER_PORT if it is set
ref: https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/.env.example#L1

Are there known steps to reproduce?

set SERVER_PORT in the env file or environment to a port other than 3001

Originally created by @chrisbennight on GitHub (Apr 27, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1206 ### How are you running AnythingLLM? Docker (local) ### What happened? Docker healthcheck fails when setting alternate SERVER_PORT in .env this line: https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/docker-healthcheck.sh#L4 should be updated and the hardcoded 3001 replaced with SERVER_PORT if it is set ref: https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/.env.example#L1 ### Are there known steps to reproduce? set SERVER_PORT in the env file or environment to a port other than 3001
yindo added the documentationDockerneeds info / can't replicate labels 2026-02-22 18:21:09 -05:00
yindo closed this issue 2026-02-22 18:21:09 -05:00
Author
Owner

@0xzrf commented on GitHub (Apr 28, 2024):

Hey @chrisbennight , I tried to reproduce this bug by changing the .env file and then running the docker-healthcheck.sh file. But apparently it seems to be working pretty fine on my side.

Could you please provide a better way to reproduce the problem that you are facing?

@0xzrf commented on GitHub (Apr 28, 2024): Hey @chrisbennight , I tried to reproduce this bug by changing the .env file and then running the docker-healthcheck.sh file. But apparently it seems to be working pretty fine on my side. Could you please provide a better way to reproduce the problem that you are facing?
Author
Owner

@timothycarambat commented on GitHub (Apr 28, 2024):

Thanks @krishhh16

@timothycarambat commented on GitHub (Apr 28, 2024): Thanks @krishhh16
Author
Owner

@chrisbennight commented on GitHub (Apr 28, 2024):

@krishhh16

The application still works, but docker sees the state of the app as unhealthy - a docker ps | grep anything (replace anything with your container name if it's different) will show the unhealthy state. So if you were checking by going to the webpage it works fine - it's just reporting the wrong thing to docker

(which makes sense because the healthcheck is hard coded to port 3001 - if that's changed (by setting SERVER_PORT) then nothing responds to the healthcheck.

The app works, but docker think's it's down, so using automations like autoheal, etc have bad interactions

Example docker output with docker compose below it (setting port to 3009 via env)

user@server:~$ docker ps | grep any
4ddff5f3ee12   mintplexlabs/anythingllm:latest   "/bin/bash /usr/loca…"   5 minutes ago   Up 5 minutes (unhealthy)   3001/tcp, 0.0.0.0:3009->3009/tcp, :::3009->3009/tcp                                                                               anything-llm                                                                                        anything-llm

Where it says unhealthy it should say healthy (which it does if SERVER_PORT is left at 3001)

the above is with:

version: "3.9"
name: anythingllm
services:
  anything-llm:
    container_name: anything-llm
    image: mintplexlabs/anythingllm:latest
    cap_add:
      - SYS_ADMIN
    volumes:
      - "allm-storage:/app/server/storage"
      - "allm-hotdir:/app/collector/hotdir"
      - "allm-outputs:/app/collector/outputs"
    user: "${UID:-1000}:${GID:-1000}"
    ports:
      - "3009:3009"
    environment:
      - SERVER_PORT=3009
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

volumes:
  allm-storage:
    driver_opts:
      type: "nfs"
      o: "nfsvers=4,addr=nas.address,rw"
      device: ":/volume1/docker2/anything_llm/storage"
  allm-hotdir:
    driver_opts:
      type: "nfs"
      o: "nfsvers=4,addr=nas.address,rw"
      device: ":/volume1/docker2/anything_llm/hotdir"
  allm-outputs:
    driver_opts:
      type: "nfs"
      o: "nfsvers=4,addr=nas.address,rw"
      device: ":/volume1/docker2/anything_llm/outputs"

Does this help?

@chrisbennight commented on GitHub (Apr 28, 2024): @krishhh16 The application still works, but docker sees the state of the app as unhealthy - a `docker ps | grep anything` (replace anything with your container name if it's different) will show the unhealthy state. So if you were checking by going to the webpage it works fine - it's just reporting the wrong thing to docker (which makes sense because the healthcheck is hard coded to port 3001 - if that's changed (by setting SERVER_PORT) then nothing responds to the healthcheck. The app works, but docker think's it's down, so using automations like autoheal, etc have bad interactions Example docker output with docker compose below it (setting port to 3009 via env) ``` user@server:~$ docker ps | grep any 4ddff5f3ee12 mintplexlabs/anythingllm:latest "/bin/bash /usr/loca…" 5 minutes ago Up 5 minutes (unhealthy) 3001/tcp, 0.0.0.0:3009->3009/tcp, :::3009->3009/tcp anything-llm anything-llm ``` Where it says `unhealthy` it should say `healthy` (which it does if SERVER_PORT is left at 3001) the above is with: ``` version: "3.9" name: anythingllm services: anything-llm: container_name: anything-llm image: mintplexlabs/anythingllm:latest cap_add: - SYS_ADMIN volumes: - "allm-storage:/app/server/storage" - "allm-hotdir:/app/collector/hotdir" - "allm-outputs:/app/collector/outputs" user: "${UID:-1000}:${GID:-1000}" ports: - "3009:3009" environment: - SERVER_PORT=3009 labels: - "com.centurylinklabs.watchtower.enable=true" volumes: allm-storage: driver_opts: type: "nfs" o: "nfsvers=4,addr=nas.address,rw" device: ":/volume1/docker2/anything_llm/storage" allm-hotdir: driver_opts: type: "nfs" o: "nfsvers=4,addr=nas.address,rw" device: ":/volume1/docker2/anything_llm/hotdir" allm-outputs: driver_opts: type: "nfs" o: "nfsvers=4,addr=nas.address,rw" device: ":/volume1/docker2/anything_llm/outputs" ``` Does this help?
Author
Owner

@timothycarambat commented on GitHub (Apr 28, 2024):

Can you do this in the services>anything-llm object to override the default health-check.sh?

healthcheck:
   test: "curl --silent --fail http://localhost:{$SERVER_PORT}/api/ping/ > /dev/null || exit 1"
@timothycarambat commented on GitHub (Apr 28, 2024): Can you do this in the `services`>`anything-llm` object to override the default health-check.sh? ```yaml healthcheck: test: "curl --silent --fail http://localhost:{$SERVER_PORT}/api/ping/ > /dev/null || exit 1" ```
Author
Owner

@chrisbennight commented on GitHub (Apr 28, 2024):

Yep, that works with two small tweaks, have to double escape the in docker-compose, and fix the typo with the outside the curly brace

($$ just because it's in compose)

healthcheck:
      test: "curl --silent --fail http://localhost:$${SERVER_PORT}/api/ping/ > /dev/null || exit 1"

works (added to the previous docker-compose) (healthy)

user@server:~$ docker ps | grep any
3e317e3a0f9a   mintplexlabs/anythingllm:latest                           "/bin/bash /usr/loca…"   About a minute ago   Up About a minute (healthy)   3001/tcp, 0.0.0.0:3009->3009/tcp, :::3009->3009/tcp                                                                               anything-llm
user@server:~$ docker inspect --format "{{json .State.Health }}" 3e317 | jq
{
  "Status": "healthy",
  "FailingStreak": 0,
  "Log": [
    {
      "Start": "2024-04-28T22:36:21.175748576Z",
      "End": "2024-04-28T22:36:21.285086833Z",
      "ExitCode": 0,
      "Output": ""
    }
  ]
}
@chrisbennight commented on GitHub (Apr 28, 2024): Yep, that works with two small tweaks, have to double escape the $ in docker-compose, and fix the typo with the $ outside the curly brace ($$ just because it's in compose) ``` healthcheck: test: "curl --silent --fail http://localhost:$${SERVER_PORT}/api/ping/ > /dev/null || exit 1" ``` works (added to the previous docker-compose) (healthy) ``` user@server:~$ docker ps | grep any 3e317e3a0f9a mintplexlabs/anythingllm:latest "/bin/bash /usr/loca…" About a minute ago Up About a minute (healthy) 3001/tcp, 0.0.0.0:3009->3009/tcp, :::3009->3009/tcp anything-llm user@server:~$ docker inspect --format "{{json .State.Health }}" 3e317 | jq { "Status": "healthy", "FailingStreak": 0, "Log": [ { "Start": "2024-04-28T22:36:21.175748576Z", "End": "2024-04-28T22:36:21.285086833Z", "ExitCode": 0, "Output": "" } ] } ```
Author
Owner

@chrisbennight commented on GitHub (Apr 29, 2024):

Appreciate the quick response!
I would still suggest updating the baked in healthcheck file:

https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/docker-healthcheck.sh#L4

@chrisbennight commented on GitHub (Apr 29, 2024): Appreciate the quick response! I would still suggest updating the baked in healthcheck file: https://github.com/Mintplex-Labs/anything-llm/blob/d72f1af36193200f71f5f0e52aef3d68204cc535/docker/docker-healthcheck.sh#L4
yindo changed title from [Docs]: Docker - how to use non-default port to [GH-ISSUE #1206] [Docs]: Docker - how to use non-default port 2026-06-05 14:36:58 -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#747