Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debug Docker Container Port Problem
Debug Docker Container Port Problem [message #1796756] Thu, 18 October 2018 14:15 Go to next message
Claudio Rossner is currently offline Claudio RossnerFriend
Messages: 4
Registered: October 2018
Junior Member
Hi at all - my first post:-)

I did install EclipseCDT Photon and using Docker for compiling an debugging.

This is working:-)

But when i setup configuration to debug my app i cannot add a port which my app (webservice) is using, so i am wonder how can i do that?

In detail:
In the configuration Tab for Container i can just select the connection, the image and Host Directories and som eadditional options but there is no Editbox to parametrize a Port which should be open between Container and Host during debug

Any help?

Thanks - Claudio
Re: Debug Docker Container Port Problem [message #1796972 is a reply to message #1796756] Tue, 23 October 2018 11:47 Go to previous messageGo to next message
Claudio Rossner is currently offline Claudio RossnerFriend
Messages: 4
Registered: October 2018
Junior Member
Really no help?

Maybe my description of the problem is not good enough, i try it again:-)

- I have installed latest EclipseCDT (Photon) on my Host => Linux CentOS 7 - running fine
- I have a C++ Application created which is a Webservice - code and binary is on my Host
- I have also installed Docker on this CentOS 7 - running fine
- I have created a Docker Image with Alpine Linux, G++, GDB, GDBServer and some more Libs (Boost, WT...) in there needed for my C++ Application to work/run (these Libs are not installed on my Host - only in the docker image)
- I did start the Docker-Image (mydocker/images:cpp-app) and the container runs, EclipseCDT is finding the Libs and can compile the code so i get the binary from my C++-Source-Code

So everything is fine til here, but now i want to debug this C++ App/Binary - this needs Debugging within a container, for that i have parametrized the following:
Debug Configurations:
[C/C++ Container Launcher]
Project: MyCppApp
C/C++ Application: Debug/MyCppApp
Arguments: --http-address=0.0.0.0 --http-port=8166
[Container]
Connection: unix:///var/run/docker.sock
Image: mydocker/images:cpp-app
Required host directories: /home/myuser/MyCppApp
Additional Options: Checked all (Keep Container after Launch, Support stdin input, Run in privileged mode)

Now when i run this "Debug Configuration" the container is running (ip 172.17.0.1), gdbserver is connected on Port 2345 and my app is running as webservice listening on port 8166.
I can set breakpoints to the main function and see my webservice-app is listening on Port 8166 inside the container - this is working:-)
But when i want to access from Browser on my Host to Port localhost:8166, 127.0.0.1:8166 or to 172.17.0.1:8166 (representing my WebService-App) this does not work, Browser cannot find something behind this adress/port.

What else i did do:

- I did add a network rule described here (because i saw a docker warning in a logfile => WARNING: IPv4 forwarding is disabled. Networking will not work): https://stackoverflow.com/questions/41453263/docker-networking-disabled-warning-ipv4-forwarding-is-disabled-networking-wil
add the following to /etc/sysctl.conf:
net.ipv4.ip_forward=1
Restarted the whole PC....does not help too:-(

- I did create a new dockerfile with an EXPOSE 8166 statement, so i got a new image which i start within eclipse and i can se now in the Containers View that Port 8116 inside the container is mapped to Host Port 32768...but access to this port does not work too:-( So all of these are not working: localhost:32768, 127.0.0.1:32768 or to 172.17.0.1:32768 - but i get not a "not reachable" message as before, instead i get a endless "wait to connect" message
Hint: When i run the Debug-Configuration-Launcher then in the "Containers Overview" i see on Column "Ports" this "0.0.0.0.:32768->2345/tcp, 8166/tcp"

Any Tip what could be wrong?

Re: Debug Docker Container Port Problem [message #1797027 is a reply to message #1796972] Wed, 24 October 2018 09:37 Go to previous messageGo to next message
Claudio Rossner is currently offline Claudio RossnerFriend
Messages: 4
Registered: October 2018
Junior Member
I am pretty sure now, that just the parametrization of optional Ports are missing in the configuration of EclipseCDT Photon, so it is currently not possible to debug Applications which are using own Ports to communicate as e.g. WebService with the host.

An alternative could be attach to a running container, because i could start the container with all ports i need in a terminal window:

docker run --name=MyCppApp -itd -p 32770:2345 -p 8166:8166 -v /home/myuser/MyCppApp:/home/MyCppApp -w /home/myuser/MyCppApp mydocker/images:cpp-app gdbserver :2345 /home/myuser/MyCppApp/Debug/MyCppApp --http-address=0.0.0.0 --http-port=8166 --approot /home/myuser/MyCppApp/src/approot/ -c /home/myuser/MyCppApp/src/approot/wt_config.xml --module Bootstrap --docroot="/home/myuser/MyCppApp/src/docroot/;/assets,/resources"

So but now how i have to parametrize Eclipse-Launcher to attach to this running container including using GDBServer running in the docker container using on Host-Port 32770?

Hopefully anyone has a solution?
Re: Debug Docker Container Port Problem [message #1797104 is a reply to message #1797027] Thu, 25 October 2018 09:36 Go to previous message
Claudio Rossner is currently offline Claudio RossnerFriend
Messages: 4
Registered: October 2018
Junior Member
Shortly: "Container-Launcher-Configuration => Port Binding is missing"

Needed to run/debug WebService-Binaries which communicate between Host and Container through Ports.

Is there a list available for EclipseCDT where can i add an entry for this feature?
Previous Topic:Codan problem/bug?
Next Topic:Detecting include paths and preprocessor symbols(
Goto Forum:
  


Current Time: Thu Apr 25 18:03:06 GMT 2024

Powered by FUDForum. Page generated in 5.02900 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top