I am trying to execute anything-llm
from docker and I am trying to create a docker-compose.yml
file, becuase I want it to execute more than 1 container.
In the respository of anything.llm it shows how to execute from docker and it works well from me.
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
But like a said before, I want it to create a docker-compose.yml
file to execute multiple containers with just one file. This is my docker-compose.yml
code:
services:
anythingllm:
image: mintplexlabs/anythingllm
ports:
- "3001:3001"
cap_add:
- SYS_ADMIN
volumes:
- ${STORAGE_LOCATION}:/app/server/storage
- ${STORAGE_LOCATION}/.env:/app/server/.env
environment:
- STORAGE_DIR=/app/server/storage
command: /bin/sh -c "mkdir -p $STORAGE_LOCATION && touch "$STORAGE_LOCATION/.env" && npm start"
It download the image, create the container, also create the STORAGE_LOCATION
directory and the .env
file. But when is going to start the container I got the following error:
container init: error mounting "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/..."
Of course is going to return an error because inside of /run/
I don’t have the desktop
directory.
I am trying to execute anything-llm
from docker and I am trying to create a docker-compose.yml
file, becuase I want it to execute more than 1 container.
In the respository of anything.llm it shows how to execute from docker and it works well from me.
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
But like a said before, I want it to create a docker-compose.yml
file to execute multiple containers with just one file. This is my docker-compose.yml
code:
services:
anythingllm:
image: mintplexlabs/anythingllm
ports:
- "3001:3001"
cap_add:
- SYS_ADMIN
volumes:
- ${STORAGE_LOCATION}:/app/server/storage
- ${STORAGE_LOCATION}/.env:/app/server/.env
environment:
- STORAGE_DIR=/app/server/storage
command: /bin/sh -c "mkdir -p $STORAGE_LOCATION && touch "$STORAGE_LOCATION/.env" && npm start"
It download the image, create the container, also create the STORAGE_LOCATION
directory and the .env
file. But when is going to start the container I got the following error:
container init: error mounting "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/..."
Of course is going to return an error because inside of /run/
I don’t have the desktop
directory.
I found a few things:
- If I execute first, the command:
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
And then stop the container and executed the docker-compose.yml
file it start the container without any error.
- I tried replacing the variable in the
docker-compose.yml
with the directory like:/home/user/anythingllm
, but still I am getting the error when is executed for the first time.
What do I need to change to the docker-compose.yml
file works fine without executing the raw command from the terminal?
2
Answers
The issue was in the last line on the
docker-compose.yml
file.For some reason the
touch "$STORAGE_LOCATION/.env"
was not creating a.env
file but it was creating a.env
folder. So I decided to create it manually and now create and execute it correctly.what content is .env
I got error, unable to open database file ../storage/anythingllm.db