I'm trying to run debug mode in Pycharm on Linux (Ubuntu) with Docker of Lean. I followed the instruction at the Lean page
https://github.com/QuantConnect/Lean/blob/master/.idea/readme.md#Running-Lean-in-the-ContainerHowever, when I start Pycharm (Debug Server) first, then Docker, Docker will fail, saying 'address already in use'. If I did it the other way, Pycharm will fail, saying 'Failed to find free port'. It seems that when either Pycharm or Docker starts, it will attempt to get a hold on to the port, hence when Docker starts (as per instruction) it is unable to get hold of the port. I've tried to change the command for Docker "-p 5678:5678" to "-p 127.0.0.1:5678:5678" (or even IP address) to attempt to make Docker to 'connect to' rather than to 'listen'. That doesn't help.
Docker version 19.03.13
Python 2.7.17
PyCharm Pro 2019.1.3
Hussain
I'm facing a similar problem to Engp0963 but on Windows.
It used to work for me and today it failed with error 'Ports are not available'. I'm following the same instructions
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:5678: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted
Docker version 20.10.0
Pycharm Professional 2020.3
Python 3.6
Colton Sellers
Hey guys,
Looking into this now and I am seeing the same error. It definitely has something to do with dockers port mapping now denying the binding. Good news is I have found a quick workaround that you guys can use. I will also be creating a ticket in QuantConnect/Lean to make sure we can permanently address this and make sure all functionality is returned.
The workaround is nice and simple all you have to do is replace the port binding line in your run_docker.bat/.sh script
`-p 5678:5678` with `--network host`
This workaround changes the container to bind directly to the Docker host’s network, with no network isolation. For all Lean purposes this actually simplifies things and maybe be considered for the permanent solution. We will have to do some indepth testing to ensure it doesn't negatively impact anything else (such as IQFeed).
Hope this helps and thank you for reporting this error!
Colton Sellers
Colton Sellers
I created an issue ticket for this here
Thanks again!
Colton Sellers
Colton Sellers
Just an update to this issue, after testing I found that `--network host` is not a permanent solution as it affects C# debugging. Thankfully I found another solution that works and returns this functionality. The PR is here.
This will likely be merged within a couple of days!
Colton Sellers
Engp0963
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!