Repository navigation
[Bug]: rror response from daemon: failed to create task for container: failed to create shim task... #1400
Description
Activity
感谢反馈,截图中的报错发生在 Docker 容器启动前的挂载阶段:Compose 正在把项目目录中的
config.toml挂载到容器里的/MoneyPrinterTurbo/config.toml,但挂载失败了。这与您本机的 Python 3.12.3 版本无关。请在 WSL 中进入项目目录,先检查文件类型:
cd /home/projects/MoneyPrinterTurbo ls -ld config.example.toml config.toml- 如果提示
config.toml不存在,请执行cp config.example.toml config.toml。 - 如果
config.toml显示为目录(权限行以d开头),请先运行ls -la config.toml检查其中是否有文件。只有确认它是空目录后,才执行rmdir config.toml,然后执行cp config.example.toml config.toml;若目录内有内容,请先不要删除,直接把检查结果发给我们。 - 如果它已经是普通文件,请先不要覆盖它。
确认
config.toml是普通文件后,重新运行:docker compose -f docker-compose.release.yml up
如果仍报错,请贴出
ls -ld config.example.toml config.toml和docker compose -f docker-compose.release.yml config的输出,以及新的完整错误文本;发送前请隐藏可能包含的密钥等敏感信息。我们会继续帮您定位。- 如果提示
root@DESKTOP-FNVT0OB:/home/projects/MoneyPrinterTurbo# ls -ld config.example.toml config.toml
-rw-r--r-- 1 root root 29512 Sep 23 11:29 config.example.toml
-rw-r--r-- 1 root root 29512 Sep 23 13:40 config.toml
root@DESKTOP-FNVT0OB:/home/projects/MoneyPrinterTurbo# docker compose -f docker-compose.release.yml config
name: moneyprinterturbo
services:
api:
command:
- python3
- main.py
container_name: moneyprinterturbo-api
image: ghcr.io/harry0703/moneyprinterturbo:latest
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 8080
published: "8080"
protocol: tcp
restart: always
volumes:
- type: bind
source: \wsl.localhost\Ubuntu\home\projects\MoneyPrinterTurbo\config.toml
target: /MoneyPrinterTurbo/config.toml
bind:
create_host_path: true
- type: bind
source: \wsl.localhost\Ubuntu\home\projects\MoneyPrinterTurbo\storage
target: /MoneyPrinterTurbo/storage
bind:
create_host_path: true
webui:
command:
- streamlit
- run
- ./webui/Main.py
- --server.address=0.0.0.0
- --server.port=8501
- --browser.serverAddress=127.0.0.1
- --server.enableCORS=True
- --browser.gatherUsageStats=False
- --client.toolbarMode=minimal
- --logger.hideWelcomeMessage=True
- --server.showEmailPrompt=False
container_name: moneyprinterturbo-webui
image: ghcr.io/harry0703/moneyprinterturbo:latest
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 8501
published: "8501"
protocol: tcp
restart: always
volumes:
- type: bind
source: \wsl.localhost\Ubuntu\home\projects\MoneyPrinterTurbo\config.toml
target: /MoneyPrinterTurbo/config.toml
bind:
create_host_path: true
- type: bind
source: \wsl.localhost\Ubuntu\home\projects\MoneyPrinterTurbo\storage
target: /MoneyPrinterTurbo/storage
bind:
create_host_path: true
networks:
default:
name: moneyprinterturbo_default
x-common-volumes:- ./config.toml:/MoneyPrinterTurbo/config.toml
- ./storage:/MoneyPrinterTurbo/storage
root@DESKTOP-FNVT0OB:/home/projects/MoneyPrinterTurbo# docker compose -f docker-compose.release.yml up
[+] Running 2/0
✔ Container moneyprinterturbo-api Created 0.0s
✔ Container moneyprinterturbo-webui Created 0.0s
Attaching to moneyprinterturbo-api, moneyprinterturbo-webui
Gracefully stopping... (press Ctrl+C again to force)
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/wsl/docker-desktop-bind-mounts/Ubuntu/ecfef93e52e3a1df53b3e4a0ae4e038dde1602c478d7f4648ac3a8ef43ab7693" to rootfs at "/MoneyPrinterTurbo/config.toml": mount/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/ecfef93e52e3a1df53b3e4a0ae4e038dde1602c478d7f4648ac3a8ef43ab7693:/MoneyPrinterTurbo/config.toml (via /proc/self/fd/6), flags: 0x5000: no such file or directory: unknown
root@DESKTOP-FNVT0OB:/home/projects/MoneyPrinterTurbo#
感谢您提供完整的检查结果!您已经确认
config.toml是普通文件,因此我上次提到的“文件缺失或误建成目录”并不是这次报错的原因,抱歉让您多检查了一步。现在错误仍发生在容器进程启动之前,具体是在 Docker Desktop 将 WSL 中的
config.toml挂载进容器时。请先完整退出 Docker Desktop,再重新启动(仅重新运行 Compose 不等于重启 Docker Desktop)。待 Docker Desktop 显示运行正常后,在 Ubuntu/WSL 的项目目录执行:cd /home/projects/MoneyPrinterTurbo docker compose -f docker-compose.release.yml down docker compose -f docker-compose.release.yml up --force-recreate这里不要加
-v;上述命令不会删除项目目录中的config.toml或storage。如果仍然出现相同的挂载错误,请继续在同一个 WSL 终端执行并贴出结果:command -v docker docker version docker compose version同时请告知 Docker Desktop 的版本,并贴出重试后的完整错误信息。这样我们可以进一步区分 WSL 文件挂载状态与 Docker CLI/Compose 环境的问题。请勿贴出
config.toml的内容或 API Key。Your diagnosis is precise: the failure is at the Compose bind-mount stage, before the container process starts, mounting
config.tomlinto/MoneyPrinterTurbo/config.toml. shell-ye confirmedconfig.tomlis a regular file, ruling out the 'built as a directory' trap; the remaining suspect is Docker Desktop's WSL mount state (hence your 'restart Docker Desktop fully' step).A pre-flight validator that parses
docker-compose.release.ymland checks every bind-mount source resolves to an existing regular file would catch this class without a fullup.# for each service volume 'src:dst': assert os.path.isfile(src)Happy to draft that check if useful.
The
docker compose configoutput shows the bind source as\\wsl.localhost\Ubuntu\...\config.toml, a Windows UNC path. That means thedockerbeing run inside WSL is the Windows Docker CLI, not the Linux one. Docker Desktop often fails to bind-mount a single file from a\\wsl.localhostpath, which matches this error.Fix: Docker Desktop → Settings → Resources → WSL Integration → enable Ubuntu → Apply & Restart. Then in WSL,
command -v dockershould print/usr/bin/docker(not/mnt/c/...), anddocker compose -f docker-compose.release.yml configshould showsource: /home/projects/MoneyPrinterTurbo/config.toml. Then runupagain.
问题描述 | Current Behavior
当我使用 docker compose -f docker-compose.release.yml up 启动项目时,就报错了
重现步骤 | Steps to Reproduce
docker compose -f docker-compose.release.yml up
错误日志 | Error Logs
Python 版本 | Python Version
Python 3.12.3
操作系统 | Operating System
WSL2
MoneyPrinterTurbo 版本 | Version
未知,刚拉的
补充信息 | Additional Information
No response