Works with running it Windows also.
EDIT - too late ![]()
Share and learn in the Docker community.
Works with running it Windows also.
EDIT - too late ![]()
Thank you for testing then
I am still curious, so I have one more suggestions to try.
@meyay showed how you can test the ports on Windows, but we should also test it inside the WSL distro. You can use either netstat or “ss” which is “the new netstat”.
ss -ltpn | grep 8081
We should see the springboot API listening on an IP. Maybe it is listening on IPv6 only. “localhost” could still work as the browser tries to resolv it to ipv4 and then ipv6, but when I test host.docker.internal, it works on IPv4. A python command for testing the http server on IPv6:
python3 -m http.server --bind "::" 8087
If there is a way to make host.docker.internal work on ipv6, I couldn’t find it yet. Not even when I switch to “ipv6 only” mode in Docker Desktop.
I get this when running that command:
❯ ss -ltpn | grep 8081
LISTEN 0 100 *:8081 *:* users:(("java",pid=40890,fd=273))
Also by too late in my previous reply, I meant the edit you said too not test on windows was too late as I already had. I am still available to do testing ![]()
Okay, I shared the wrong command in my previous message. Please, try this one:
ss -ltpne | grep 8081
If the process is listening on ipv6 only, it should show it at the end of the line as “v6only:0”
I am posting only because for some reason @aliahmad05 was not allowed to post again here by discourse. So it turned out the Springboot API server indeed listened on ipv6 only.
The question still remains. Whether host.docker.internal should work on ipv6. I will share if I figure it out.
Hey, do you have any update for this?
-Djava.net.preferIPv4Stack=true
For now adding this as command line arg to my spring boot application allows host.docker.internal to work
Thank you for reminding me. I tested it again , but now on my Mac as well. IPv6 works on my Mac, but not on my Windows. So I played with some settings and I noticed that I had to select “No filtering” on the Settings » Resourcdes tab in Docker Desktop under “Inhibit DNS resolution for IPv4 / IPv6”. Of course, the “Default networking mode” also has to be Dual IPv4/IPv6.
I didn’t mentioned this before, because I tested it with "Dual " and that didn’t work, but I guess I didn’t change the DNS setting.
My DNS setting on MacOS is still on Auto in Docker DEsktop, but I had to change it on Windows.
And it works now.
NOTE: I updated to Docker Desktop 4.56 before I made it work, so I am not sure if that was also necessary or not.
That is great to read. If you feel my last comment is acceptable as solution, please mark it as solution by clicking on the checkbox icon under the post near the Reply button..
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.