Skip to content

fix(config): explain how to fix a Docker bind-mounted config.toml folder - #1753

Merged
harry0703 merged 1 commit into
harry0703:mainfrom
ChandraChaan:fix/docker-config-bind-mount-message
Nov 2, 2026
Merged

harry0703 merged 1 commit into
harry0703:mainfrom
ChandraChaan:fix/docker-config-bind-mount-message

Conversation

@ChandraChaan

Copy link
Copy Markdown
Contributor

Fixes #1751.

When config.toml does not exist on the host, docker compose -f docker-compose.release.yml up creates an empty config.toml folder in its place and mounts it into both containers. load_config() then tries to os.rmdir() that folder, but it is the mount point itself, so Linux answers OSError: [Errno 16] Device or resource busy. The API container exits with:

IsADirectoryError: /MoneyPrinterTurbo/config.toml is a directory and cannot be used as the config file; move or rename it, then restart

and restart: always repeats this forever. "Move or rename it" cannot be done from inside the container, and the message does not say the folder was created by Docker on the host.

An EBUSY from rmdir now raises IsADirectoryError that says the folder exists because config.toml was missing on the host when Docker mounted it, and to stop the containers, delete the empty config.toml folder next to the compose file, copy config.example.toml to config.toml, and start again (the step the README's Docker section already asks for). Other OSErrors keep the current message and the existing NotADirectoryError race handling is unchanged.

Added test_busy_docker_bind_mount_stub_explains_the_host_fix next to the existing Docker stub tests in test/services/test_config_initialization.py; it simulates the EBUSY from rmdir and checks the folder is left in place.

I did not run the containers end to end; the EBUSY comes from the traceback in the issue.

When config.toml does not exist on the host, `docker compose up` creates
an empty folder in its place and mounts it. load_config() then tries to
remove that folder, but it is the mount point itself, so Linux answers
EBUSY and the container restarts forever with "move or rename it, then
restart", which cannot be done from inside the container (harry0703#1751).

An EBUSY from rmdir now raises IsADirectoryError that says the folder
came from Docker and how to fix it on the host: stop the containers,
delete the empty config.toml folder, copy config.example.toml to
config.toml, and start again.
@ChandraChaan

Copy link
Copy Markdown
Contributor Author

CI here is waiting for workflow approval, so I ran the same CI workflow on my fork: ruff is clean and the unit tests pass on Python 3.11 and 3.13 (3119 passed, 114 skipped), plus the Windows smoke tests. https://github.com/ChandraChaan/MoneyPrinterTurbo/actions/runs/41391205500

@harry0703
harry0703 merged commit 10714e1 into harry0703:main Nov 2, 2026
3 checks passed
@harry0703

Copy link
Copy Markdown
Owner

Merged, thank you! I reproduced the bind-mount error with Docker Compose and checked the host-side recovery steps. Explaining where the folder comes from and how to replace it with a config file should make this much easier to resolve. Existing valid config files also loaded without changing their contents.

@whataboutio

Copy link
Copy Markdown

Why it does not work for me after this steps:

  • rm config.toml dir;
  • cp config.example.toml config.toml?

Attaching to moneyprinterturbo-api, moneyprinterturbo-webui 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 "/host_mnt/Users/*/*/MoneyPrinterTurbo/config.toml" to rootfs at "/MoneyPrinterTurbo/config.toml": mount src=/host_mnt/Users/*/*/MoneyPrinterTurbo/config.toml, dst=/MoneyPrinterTurbo/config.toml, dstFd=/proc/thread-self/fd/14, flags=MS_BIND|MS_REC: not a directory: 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

@whataboutio

Copy link
Copy Markdown

Why it does not work for me after this steps:

  • rm config.toml dir;
  • cp config.example.toml config.toml?

Attaching to moneyprinterturbo-api, moneyprinterturbo-webui 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 "/host_mnt/Users/*/*/MoneyPrinterTurbo/config.toml" to rootfs at "/MoneyPrinterTurbo/config.toml": mount src=/host_mnt/Users/*/*/MoneyPrinterTurbo/config.toml, dst=/MoneyPrinterTurbo/config.toml, dstFd=/proc/thread-self/fd/14, flags=MS_BIND|MS_REC: not a directory: 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

solved:
docker compose -f docker-compose.release.yml up --force-recreate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:

3 participants