I am trying to set Lean engine for python on macos using vscode as described here
When I try to run the container, I get
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:55555: bind: address already in use.
This is the log output
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
so I am very confused at the moment as I dont have anything running on 55555
➜ Homestead git:(release) sudo lsof -i:55555
Password:
➜ Homestead git:(release)
This is the same whether I am doing "Run in container" in VsCode or trying to run the container via docker desktop.
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
416ab7089c13 quantconnect/lean:latest "mono --debug --debu…" About a minute ago Created LeanEngine
I dont have any nginx or apache running. My hosts file is the default unaltered. The only thing I have installed is vagrant with virtual box and a Laravel homestead vm.
I'd really appreciate any input. Thank you for looking
Update
Thank's to Terry's comment, I now know that it is related to the debugging option. When I disable debugging then run the debug in container, it goes all the way. It runs the command below compared to the one above
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
Still not sure why this is happening and I would like to be able to debug. I've set the mono version to 15.8 in vscode as stated in the github instructions. I've also installed 15.8 version on my computer as well but I get the following output
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"
In your run command, get rid of the "--debug --debugger-agent=transport=dt_socket,server=y,address=0.0.0.0:55555,suspend=y". This is trying to consume the same port which is why you are getting the address already in use error.
Running the debugger on a different port will also work as long as it isn't one of the ports you are exposing via docker.
Glad it works, thanks!