[GH-ISSUE #2537] [BUG]: Container exits #1640

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

Originally created by @tifDev on GitHub (Oct 26, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2537

How are you running AnythingLLM?

Docker (local)

What happened?

I'm launching the container like this as explained in the documentation:


export STORAGE_LOCATION=$HOME/anythingllm && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

The container tries to starts but after ~3 seconds exists.
Then I searched in web for similar errors and created the directories and set the permissions manually but issue still persists.

Docker logs:

docker logs b5afbcd66b28
[collector] info: Collector hot directory and tmp storage wiped!
[collector] info: Document processor app listening on port 8888
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 308ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)

import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()


See other ways of importing Prisma Client: http://pris.ly/d/importing-client

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db"

Error: Schema engine error:
SQLite database error
unable to open database file: ../storage/anythingllm.db

Directories seem well created with correct permissions:

image

image
chmod -R 777 $HOME/anythingllm

cd $HOME/anythingllm/app/server/storage && touch anythingllm.db

Are there known steps to reproduce?

Just run the docker command...

Originally created by @tifDev on GitHub (Oct 26, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2537 ### How are you running AnythingLLM? Docker (local) ### What happened? I'm launching the container like this [as explained in the documentation](https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md): ``` bash export STORAGE_LOCATION=$HOME/anythingllm && \ mkdir -p $STORAGE_LOCATION && \ touch "$STORAGE_LOCATION/.env" && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` The container tries to starts but after ~3 seconds exists. Then I searched in web for similar errors and created the directories and set the permissions manually but issue still persists. Docker logs: ``` docker logs b5afbcd66b28 [collector] info: Collector hot directory and tmp storage wiped! [collector] info: Document processor app listening on port 8888 Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma ✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 308ms Start using Prisma Client in Node.js (See: https://pris.ly/d/client) ``` import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() ``` or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate) ``` import { PrismaClient } from '@prisma/client/edge' const prisma = new PrismaClient() ``` See other ways of importing Prisma Client: http://pris.ly/d/importing-client Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" Error: Schema engine error: SQLite database error unable to open database file: ../storage/anythingllm.db ``` Directories seem well created with correct permissions: ![image](https://github.com/user-attachments/assets/c09572af-449a-4091-9394-314fe6379d8f) ![image](https://github.com/user-attachments/assets/b3de6107-8ce0-4b64-a649-0c28157535e4) chmod -R 777 $HOME/anythingllm cd $HOME/anythingllm/app/server/storage && touch anythingllm.db ### Are there known steps to reproduce? Just run the docker command...
yindo added the possible bug label 2026-02-22 18:25:50 -05:00
yindo closed this issue 2026-02-22 18:25:50 -05:00
Author
Owner

@tifDev commented on GitHub (Oct 26, 2024):

Similar to https://github.com/Mintplex-Labs/anything-llm/issues/1996

@tifDev commented on GitHub (Oct 26, 2024): Similar to https://github.com/Mintplex-Labs/anything-llm/issues/1996
Author
Owner

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

This is not similar to #1996, it looks like for some reason you have a directory named .env with app/server/.env in it. Should not be how that directory is structured.

I would try this just to be 100% sure everything is correct.
rm -rf $HOME/anythingllm to remove the current storage directory
mkdir $HOME/anythingllm to recreate empty directory
touch "$HOME/anythingllm/.env" to make a single .env file in the storage directory.

touch "$HOME/anythingllm/anythingllm.db" to create empty db file.

Now,

export STORAGE_LOCATION=$HOME/anythingllm && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \ 
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

I want to highlight this line -v ${STORAGE_LOCATION}/.env:/app/server/.env where it seems in your storage it create a folder and did not bind the .env file to the path in the container - which is likely what is going wrong here.

If the db is still unable to be opened, but the paths are all correct - then chmod comes into play for the solution

@timothycarambat commented on GitHub (Oct 28, 2024): This is not similar to #1996, it looks like for some reason you have a _directory named `.env`_ with app/server/.env in it. Should not be how that directory is structured. I would try this just to be 100% sure everything is correct. `rm -rf $HOME/anythingllm` to remove the current storage directory `mkdir $HOME/anythingllm` to recreate empty directory `touch "$HOME/anythingllm/.env"` to make a single `.env` file in the storage directory. `touch "$HOME/anythingllm/anythingllm.db"` to create empty `db` file. Now, ``` export STORAGE_LOCATION=$HOME/anythingllm && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` I want to highlight this line `-v ${STORAGE_LOCATION}/.env:/app/server/.env` where it seems in your storage it create a folder and did not bind the `.env` _file_ to the path in the container - which is likely what is going wrong here. If the db is still unable to be opened, but the paths are all correct - then `chmod` comes into play for the solution
Author
Owner

@tifDev commented on GitHub (Oct 31, 2024):

Did what you said but still not working:


export STORAGE_LOCATION=$HOME/anythingllm && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \ 
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

# OUTPUT: #
docker: invalid reference format.
See 'docker run --help'.
-e: command not found

@tifDev commented on GitHub (Oct 31, 2024): Did what you said but still not working: ``` export STORAGE_LOCATION=$HOME/anythingllm && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm # OUTPUT: # docker: invalid reference format. See 'docker run --help'. -e: command not found ```
Author
Owner

@timothycarambat commented on GitHub (Oct 31, 2024):

The above command works because when you opened the issue this is the same command. So you probably have a space or something after the \ on one of the lines most likely.

What is occurring now is a docker command issue, not related to AnythingLLM (or the command to start)

@timothycarambat commented on GitHub (Oct 31, 2024): The above command works because when you opened the issue _this is the same command_. So you probably have a space or something after the `\` on one of the lines most likely. What is occurring now is a docker command issue, not related to AnythingLLM (or the command to start)
Author
Owner

@tifDev commented on GitHub (Nov 1, 2024):

Thanks , here is the fixed command btw:


export STORAGE_LOCATION=$HOME/anythingllm && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v "${STORAGE_LOCATION}:/app/server/storage" \
-v "${STORAGE_LOCATION}/.env:/app/server/.env" \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

@tifDev commented on GitHub (Nov 1, 2024): Thanks , here is the fixed command btw: ``` export STORAGE_LOCATION=$HOME/anythingllm && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v "${STORAGE_LOCATION}:/app/server/storage" \ -v "${STORAGE_LOCATION}/.env:/app/server/.env" \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ```
Author
Owner

@eudemocracystiftung commented on GitHub (Nov 7, 2025):

Can't the above commands be replaced with a docker-compose.yml file? I have found (from AnythingLLM, if memory serves) but the container keeps on closing (while it does not with the above commands).

@eudemocracystiftung commented on GitHub (Nov 7, 2025): Can't the above commands be replaced with a `docker-compose.yml` file? I have found (from AnythingLLM, if memory serves) but the container keeps on closing (while it does not with the above commands).
yindo changed title from [BUG]: Container exits to [GH-ISSUE #2537] [BUG]: Container exits 2026-06-05 14:41:53 -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#1640