【发布时间】:2025-11-27 02:10:01
【问题描述】:
我正在尝试在 macos 上使用 vscode 为 python 设置精益引擎 described here
当我尝试运行容器时,我得到
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:55555: bind: address already in use.
这是日志输出
A Lean container is halted and will be removed. Continue? [y/n]: y
LeanEngine
Pulling Docker image: quantconnect/lean:latest
latest: Pulling from quantconnect/lean
Digest: sha256:ff6d17d055d27da2adcde8743628768880129ea68496e8b85a94d699543664db
Status: Image is up to date for quantconnect/lean:latest
docker.io/quantconnect/lean:latest
Launching LeanEngine with command:
docker run --rm --mount type=bind,source=/Users/odelibalta/Documents/Code/GitHub/Lean/Launcher/config.json,target=/Lean/Launcher/config.json,readonly -v /Users/odelibalta/Documents/Code/GitHub/Lean/Data:/Data:ro -v /Users/odelibalta/Documents/Code/GitHub/Lean/Results:/Results --name LeanEngine -p 5678:5678 --expose 6000 -v /Users/odelibalta/Documents/Code/GitHub/Lean/Algorithm.Python:/Lean/Algorithm.Python -p 55555:55555 --entrypoint mono quantconnect/lean:latest --debug --debugger-agent=transport=dt_socket,server=y,address=0.0.0.0:55555,suspend=y QuantConnect.Lean.Launcher.exe --data-folder /Data --results-destination-folder /Results --config /Lean/Launcher/config.json
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:55555: bind: address already in use.
ERRO[0000] error waiting for container: context canceled
所以我现在很困惑,因为我没有在 55555 上运行任何东西
➜ Homestead git:(release) sudo lsof -i:55555
Password:
➜ Homestead git:(release)
无论我是在 VsCode 中执行“在容器中运行”还是尝试通过 docker 桌面运行容器,这都是一样的。
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
416ab7089c13 quantconnect/lean:latest "mono --debug --debu…" About a minute ago Created LeanEngine
我没有运行任何 nginx 或 apache。我的主机文件是默认不变的。我唯一安装的是带有虚拟盒子和 Laravel homestead vm 的 vagrant。
非常感谢任何意见。感谢您的关注
更新
感谢特里的评论,我现在知道它与调试选项有关。当我禁用调试然后在容器中运行调试时,它会一直运行。与上面的相比,它运行下面的命令
docker run --rm --mount type=bind,source=/Users/odelibalta/Documents/Code/GitHub/Lean/Launcher/config.json,target=/Lean/Launcher/config.json,readonly -v /Users/odelibalta/Documents/Code/GitHub/Lean/Data:/Data:ro -v /Users/odelibalta/Documents/Code/GitHub/Lean/Results:/Results --name LeanEngine -p 5678:5678 --expose 6000 -v /Users/odelibalta/Documents/Code/GitHub/Lean/Algorithm.Python:/Lean/Algorithm.Python quantconnect/lean:latest --data-folder /Data --results-destination-folder /Results --config /Lean/Launcher/config.json
仍然不确定为什么会发生这种情况,我希望能够进行调试。如 github 说明中所述,我已在 vscode 中将单声道版本设置为 15.8。我也在我的电脑上安装了 15.8 版本,但我得到以下输出
Lean git:(master) ✗ msbuild --version
Microsoft (R) Build Engine version 16.0.38-preview+g300887e680 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1001: Unknown switch.
Switch: --version
For switch syntax, type "MSBuild /help"
【问题讨论】:
-
调试器代理端口是否与实际端口冲突?您可以尝试不使用调试配置来查看它是否启动吗?如果是这样,那么我猜您需要为调试代理指定不同的端口。
-
感谢您的评论。我怎样才能找到这些信息?
-
在你的运行命令中,去掉“--debug --debugger-agent=transport=dt_socket,server=y,address=0.0.0.0:55555,suspend=y”看看是否你得到同样的错误。
-
我已经更新了原帖。您正在做某事,因为当我关闭调试时,容器命令会完全执行
-
那个新错误只是意味着 --version 不是一个有效的语句。我不使用单声道,所以不确定我能有多大帮助,但我猜如果你想使用调试器,你需要在 55555 以外的端口上运行它,因为这是你用来链接主机的端口/容器。没有debug语句,容器现在启动成功了吗?
标签: python visual-studio docker macos-big-sur quantconnect