[GH-ISSUE #1337] [DOCS]: Wrong volumes in docker run command #844

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

Originally created by @cope on GitHub (May 10, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1337

Description

Took me a while to figure out why I kept getting this error:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/d/db/anythingllm/env" to rootfs at "/app/server/.env": mount /run/desktop/mnt/host/d/db/anythingllm/env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

But, it turns out that the docker run command I copied from https://docs.useanything.com/getting-started/installation/self-hosted/local-docker was wrong. There is no app directory in the container, so I needed to remove all 3 instances of app/ from the docker run command and then it worked.

Originally created by @cope on GitHub (May 10, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1337 ### Description Took me a while to figure out why I kept getting this error: `docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/d/db/anythingllm/env" to rootfs at "/app/server/.env": mount /run/desktop/mnt/host/d/db/anythingllm/env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.` But, it turns out that the docker `run command` I copied from https://docs.useanything.com/getting-started/installation/self-hosted/local-docker was wrong. There is no `app` directory in the container, so I needed to remove all 3 instances of `app/` from the `docker run` command and then it worked.
yindo added the documentation label 2026-02-22 18:21:44 -05:00
yindo closed this issue 2026-02-22 18:21:44 -05:00
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

This was a typo in you run command

/run/desktop/mnt/host/d/db/anythingllm/env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory:

Should be run/desktop/mnt/host/d/db/anythingllm/.env
-v ${STORAGE_LOCATION}/.env:/app/server/.env mounts file to file in container

What you have was essentially
-v ${STORAGE_LOCATION}/env:/app/server/.env which tries to mount a directory to a file and will fail

@timothycarambat commented on GitHub (May 10, 2024): This was a typo in you run command > /run/desktop/mnt/host/d/db/anythingllm/env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: Should be `run/desktop/mnt/host/d/db/anythingllm/.env` `-v ${STORAGE_LOCATION}/.env:/app/server/.env` mounts file to file in container What you have was essentially `-v ${STORAGE_LOCATION}/env:/app/server/.env` which tries to mount a directory to a file and will fail
Author
Owner

@cope commented on GitHub (May 10, 2024):

I didn't have run/desktop/mnt/host/d/db/anythingllm/.env anywhere in my command.

My command was docker run -d --restart unless-stopped -p 3001:3001 --cap-add SYS_ADMIN -e STORAGE_DIR="/app/server/storage" -v "D:/db/anythingllm:/app/server/storage" -v "D:/db/anythingllm/env:/app/server/.env" --name anything-llm mintplexlabs/anythingllm:master and that threw the above error.

When I removed app/ from the command and had docker run -d --restart unless-stopped -p 3001:3001 --cap-add SYS_ADMIN -e STORAGE_DIR="/server/storage" -v "D:/db/anythingllm:/server/storage" -v "D:/db/anythingllm/env:/server/.env" --name anything-llm mintplexlabs/anythingllm:master instead, then it worked.

@cope commented on GitHub (May 10, 2024): I didn't have `run/desktop/mnt/host/d/db/anythingllm/.env` anywhere in my command. My command was `docker run -d --restart unless-stopped -p 3001:3001 --cap-add SYS_ADMIN -e STORAGE_DIR="/app/server/storage" -v "D:/db/anythingllm:/app/server/storage" -v "D:/db/anythingllm/env:/app/server/.env" --name anything-llm mintplexlabs/anythingllm:master` and that threw the above error. When I removed `app/` from the command and had `docker run -d --restart unless-stopped -p 3001:3001 --cap-add SYS_ADMIN -e STORAGE_DIR="/server/storage" -v "D:/db/anythingllm:/server/storage" -v "D:/db/anythingllm/env:/server/.env" --name anything-llm mintplexlabs/anythingllm:master` instead, then it worked.
Author
Owner

@cope commented on GitHub (May 10, 2024):

btw, I find it quite disrespectful to close an issue without allowing the requestor some reasonable time to respond.

@cope commented on GitHub (May 10, 2024): btw, I find it quite disrespectful to close an issue without allowing the requestor some _reasonable_ time to respond.
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

docker run -d --restart unless-stopped \
-p 3001:3001 \
--cap-add SYS_ADMIN \
-e STORAGE_DIR="/app/server/storage" \
-v "D:/db/anythingllm:/app/server/storage" \
-v "D:/db/anythingllm/.env:/app/server/.env" \ <-- right here. You forgot a period
--name anything-llm \
mintplexlabs/anythingllm:master
@timothycarambat commented on GitHub (May 10, 2024): ``` docker run -d --restart unless-stopped \ -p 3001:3001 \ --cap-add SYS_ADMIN \ -e STORAGE_DIR="/app/server/storage" \ -v "D:/db/anythingllm:/app/server/storage" \ -v "D:/db/anythingllm/.env:/app/server/.env" \ <-- right here. You forgot a period --name anything-llm \ mintplexlabs/anythingllm:master ```
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

@cope im not being disrespectful, im just trying to address the issue and this issue is not qualified as a bug or a documentation update. It was just a simple typo and that is all i am addressing

@timothycarambat commented on GitHub (May 10, 2024): @cope im not being disrespectful, im just trying to address the issue and this issue is not qualified as a bug or a documentation update. It was just a simple typo and that is all i am addressing
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

Actually, on second glance i now see this does not even have the full storage path set. in our docs we have the command to run as

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

Assuming you dont want to use an env and your folder on the host machine is /home/user/anythingllm/ the command should look like this:

touch /home/user/anythingllm/.env && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v /home/user/anythingllm/:/app/server/storage \
-v /home/user/anythingllm/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm
@timothycarambat commented on GitHub (May 10, 2024): Actually, on second glance i now see this does not even have the full storage path set. in our docs we have the command to run as ``` 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 ``` Assuming you dont want to use an env and your folder on the host machine is `/home/user/anythingllm/` the command should look like this: ``` touch /home/user/anythingllm/.env && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v /home/user/anythingllm/:/app/server/storage \ -v /home/user/anythingllm/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ```
Author
Owner

@cope commented on GitHub (May 10, 2024):

Wait, please wait.

This command works:

docker run -d --restart unless-stopped /
-p 3001:3001 /
--cap-add SYS_ADMIN /
-e STORAGE_DIR="/server/storage" /
-v "D:/db/anythingllm:/server/storage" /
-v "D:/db/anythingllm/env:/server/.env" / <-- No period on the left and it works
--name anything-llm /
mintplexlabs/anythingllm:master/

This command does not work:

docker run -d --restart unless-stopped /
-p 3001:3001 /
--cap-add SYS_ADMIN /
-e STORAGE_DIR="/app/server/storage" /
-v "D:/db/anythingllm:/app/server/storage" /
-v "D:/db/anythingllm/env:/app/server/.env" /
--name anything-llm /
mintplexlabs/anythingllm:master/

The difference between the one working and the one not working is just the existence/absence of /app.

Now, should I change it from "D:/db/anythingllm/env" to "D:/db/anythingllm/.env" - entirely possible for other reasons, but again, the first one above with "D:/db/anythingllm/env" works fine.

@cope commented on GitHub (May 10, 2024): Wait, please wait. This command **works**: ``` docker run -d --restart unless-stopped / -p 3001:3001 / --cap-add SYS_ADMIN / -e STORAGE_DIR="/server/storage" / -v "D:/db/anythingllm:/server/storage" / -v "D:/db/anythingllm/env:/server/.env" / <-- No period on the left and it works --name anything-llm / mintplexlabs/anythingllm:master/ ``` This command _does not work_: ``` docker run -d --restart unless-stopped / -p 3001:3001 / --cap-add SYS_ADMIN / -e STORAGE_DIR="/app/server/storage" / -v "D:/db/anythingllm:/app/server/storage" / -v "D:/db/anythingllm/env:/app/server/.env" / --name anything-llm / mintplexlabs/anythingllm:master/ ``` The difference between the one working and the one not working is just the existence/absence of `/app`. Now, should I change it from "D:/db/anythingllm/env" to "D:/db/anythingllm/.env" - entirely possible for other reasons, but again, the first one above with "D:/db/anythingllm/env" works fine.
Author
Owner

@cope commented on GitHub (May 10, 2024):

I will gladly change to .env to test.

@cope commented on GitHub (May 10, 2024): I will gladly change to .env to test.
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

This makes sense since D:/db/anythingllm/env probably exists in the folder while D:/db/anythingllm/.env may not. If you create that file (D:/db/anythingllm/.env) and run the command with the .env in it should work.It may have been crashing because the file was never touch'd and the docker container does not create it.

In its current state, when the program tries to write to .env and it is mounted to a folder on the host, that fails because the node:fs write command can only write to a file - otherwise it will throw.

@timothycarambat commented on GitHub (May 10, 2024): This makes sense since `D:/db/anythingllm/env` probably exists in the folder while `D:/db/anythingllm/.env` may not. If you create that file (`D:/db/anythingllm/.env`) and run the command with the `.env` in it should work.It may have been crashing because the file was never `touch`'d and the docker container does not create it. In its current state, when the program tries to write to `.env` and it is mounted to a folder on the host, that fails because the `node:fs` write command can only write to a file - otherwise it will throw.
Author
Owner

@cope commented on GitHub (May 10, 2024):

As expected:

docker run -d --restart unless-stopped \
-p 3001:3001 \
--cap-add SYS_ADMIN \
-e STORAGE_DIR="/app/server/storage" \
-v "D:/db/anythingllm:/app/server/storage" \
-v "D:/db/anythingllm/.env:/app/server/.env" \
--name anything-llm \
mintplexlabs/anythingllm:master

Errors:

8cb44225bace9924cb8ea422096e221a4169a9e3b9710b8435ca363f63e304c4
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/d/db/anythingllm/.env" to rootfs at "/app/server/.env": mount /run/desktop/mnt/host/d/db/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

While

docker run -d --restart unless-stopped \
-p 3001:3001 \
--cap-add SYS_ADMIN \
-e STORAGE_DIR="/server/storage" \
-v "D:/db/anythingllm:/server/storage" \
-v "D:/db/anythingllm/.env:/server/.env" \
--name anything-llm \
mintplexlabs/anythingllm:master

works:

24bdc02959b37f229f3ac2cbc3330e5de35531c96b2e15fbd1530911f6ce7e4a
@cope commented on GitHub (May 10, 2024): As expected: ``` docker run -d --restart unless-stopped \ -p 3001:3001 \ --cap-add SYS_ADMIN \ -e STORAGE_DIR="/app/server/storage" \ -v "D:/db/anythingllm:/app/server/storage" \ -v "D:/db/anythingllm/.env:/app/server/.env" \ --name anything-llm \ mintplexlabs/anythingllm:master ``` Errors: ``` 8cb44225bace9924cb8ea422096e221a4169a9e3b9710b8435ca363f63e304c4 docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/d/db/anythingllm/.env" to rootfs at "/app/server/.env": mount /run/desktop/mnt/host/d/db/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. ``` While ``` docker run -d --restart unless-stopped \ -p 3001:3001 \ --cap-add SYS_ADMIN \ -e STORAGE_DIR="/server/storage" \ -v "D:/db/anythingllm:/server/storage" \ -v "D:/db/anythingllm/.env:/server/.env" \ --name anything-llm \ mintplexlabs/anythingllm:master ``` works: ``` 24bdc02959b37f229f3ac2cbc3330e5de35531c96b2e15fbd1530911f6ce7e4a ```
Author
Owner

@cope commented on GitHub (May 10, 2024):

AAAA, .env is a file??

@cope commented on GitHub (May 10, 2024): AAAA, .env is a file??
Author
Owner

@cope commented on GitHub (May 10, 2024):

docker run -d --restart unless-stopped \
-p 3001:3001 \
--cap-add SYS_ADMIN \
-e STORAGE_DIR="/app/server/storage" \
-v "D:/db/anythingllm:/app/server/storage" \
-v "D:/db/anythingllm/.env:/app/server/.env" \
--name anything-llm \
mintplexlabs/anythingllm:master

works when .env is a file............

@cope commented on GitHub (May 10, 2024): ``` docker run -d --restart unless-stopped \ -p 3001:3001 \ --cap-add SYS_ADMIN \ -e STORAGE_DIR="/app/server/storage" \ -v "D:/db/anythingllm:/app/server/storage" \ -v "D:/db/anythingllm/.env:/app/server/.env" \ --name anything-llm \ mintplexlabs/anythingllm:master ``` works when .env is a file............
Author
Owner

@cope commented on GitHub (May 10, 2024):

But, OK - I get why it failed - makes sense.

But WHY did the one without /app work, though???

@cope commented on GitHub (May 10, 2024): But, OK - I get why it failed - makes sense. But WHY did the one without `/app` work, though???
Author
Owner

@timothycarambat commented on GitHub (May 10, 2024):

I feel like we were talking around the same thing but just weren't communicating effectively haha. yes .env is a file.

Im sorry, I look at this code too much and start making assumptions.

Also to reiterate, i really did mean no offense from closing the issue. I think i was just on a different page when I was answering the original issue.

how the one without /app worked is honestly confusing. The app layout in container is like

/app
-/server
| -/storage
|--.env
-/collector

So maybe by pure luck the paths work?

Even with the missing /app part, I think at some later point some process would have exploded but who knows? Either way, glad that got sorted

@timothycarambat commented on GitHub (May 10, 2024): I feel like we were talking around the same thing but just weren't communicating effectively haha. yes `.env` is a **file**. Im sorry, I look at this code too much and start making assumptions. Also to reiterate, i really did mean no offense from closing the issue. I think i was just on a different page when I was answering the original issue. **how** the one without `/app` worked is honestly confusing. The app layout in container is like ``` /app -/server | -/storage |--.env -/collector ``` So maybe by pure luck the paths work? Even with the missing `/app` part, I think at some later point some process would have exploded but who knows? Either way, glad that got sorted
Author
Owner

@cope commented on GitHub (May 10, 2024):

Im sorry, I look at this code too much and start making assumptions.

Believe me, I get that 😄

Also to reiterate, i really did mean no offense from closing the issue. I think i was just on a different page when I was answering the original issue.

No worries. It's my pet peeve :bowtie:

how the one without /app worked is honestly confusing.
So maybe by pure luck the paths work?

Actually, bad luck since it caused me to frame into the very wrong "solution" and be like "why is he telling me to add the damn period when it works without it" 😄😄😄

But, also glad we got it sorted ☺️

@cope commented on GitHub (May 10, 2024): > Im sorry, I look at this code too much and start making assumptions. Believe me, I get that 😄 > Also to reiterate, i really did mean no offense from closing the issue. I think i was just on a different page when I was answering the original issue. No worries. It's my pet peeve :bowtie: > **how** the one without `/app` worked is honestly confusing. > So maybe by pure luck the paths work? Actually, bad luck since it caused me to frame into the very wrong "solution" and be like "_why is he telling me to add the damn period when it works without it_" 😄😄😄 But, also glad we got it sorted :relaxed:
yindo changed title from [DOCS]: Wrong volumes in `docker run` command to [GH-ISSUE #1337] [DOCS]: Wrong volumes in `docker run` command 2026-06-05 14:37:31 -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#844