Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to Xdebug port inside Podman container #7732

Closed
1 of 2 tasks
voquangphu opened this issue Nov 21, 2021 · 4 comments
Closed
1 of 2 tasks

Cannot connect to Xdebug port inside Podman container #7732

voquangphu opened this issue Nov 21, 2021 · 4 comments
Labels

Comments

@voquangphu
Copy link

Version

Microsoft Windows [Version 10.0.19042.1348]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.16

Distro Version

Ubuntu 20.04 LTS

Other Software

Podman version 3.3.1
IntelliJ 2021.2.3 (Community Edition)

Repro Steps

  1. Setup WSL2 setting to be able to build image for old CentOS version, create %USERPROFILE%/.wslconfig with the below config
[wsl2]
kernelCommandLine=vsyscall=emulate

Restart computer, inside Ubuntu check if vsyscall=emulate is in output

cat /proc/cmdline
-> initrd=\initrd.img panic=-1 pty.legacy_count=0 nr_cpus=4 vsyscall=emulate
  1. Inside Ubuntu install Podman, set shortname to quay.io (/etc/containers/registries.conf.d/000-shortnames.conf)
[aliases]
  # centos
  "centos" = "quay.io/centos/centos"
  1. Run a CentOS 6 base instance with port mapping 8080 and 8000
podman run -td --name centos -p 8080:8080 -p 8000:8000 centos:6.10 bash -l
  1. Install Java 1.8 and Tomcat 7

  2. Setup Catalina option in /usr/share/tomcat/conf/tomcat.conf with the below option

CATALINA_OPTS="-Dlog.host=`hostname -s` -Xms256m -Xmx256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+UseG1GC -Djava.security.egd=file:/dev/./urandom -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
  1. Start tomcat service using service tomcat start
  2. On Windows host, run IntelliJ, setup remote JVM debug to Attach to remote JVM to localhost:8000
  3. Run the above debug configuration

Expected Behavior

IntelliJ debugger can connect to port 8000

Actual Behavior

Unable to open debugger port (Connection refused: connect)

Diagnostic Logs

I use the same recipe for Docker with WSL2 backend, IntelliJ can connect to debug port, but not Podman running inside WSL2, so maybe there is some problem with forwarding TCP port.
Both Docker and Podman containers port 8080 (HTTP) can be accessed by using localhost:8080.
Here is netstat output for Docker and Podman port (I run them at the same time, so setting Docker on 8000 and Podman on 8001).

PS C:\Users\christopher.vo> netstat -a | findstr :8000
  TCP    0.0.0.0:8000           P50442:0               LISTENING
  TCP    [::]:8000              P50442:0               LISTENING
  TCP    [::1]:8000             P50442:0               LISTENING
PS C:\Users\christopher.vo> netstat -a | findstr :8001
  TCP    [::1]:8001             P50442:0               LISTENING
@craigloewen-msft
Copy link
Member

Could you try connecting via the IP address instead of localhost? You can find it here:
image

@OneBlue

@voquangphu
Copy link
Author

This works!
Thanks a lot for the suggestion, it still would be better to be accessed from localhost though...

@davdr
Copy link

davdr commented Dec 19, 2021

Looks like it's the same problem as here: #4851, and due to a difference in the way Podman and Docker bind their listening sockets you run into this.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants