then enter container , run netstat -tlnp, only ipv6 port listening
other container such as nginx can find port on machine, nginx is both listening on ipv4,ipv6
I guess the ports of the springboot project cannot be mapped.
so, is there a solution? or is bug?
Do you have connection error as well, or just want to list used ports? You will never have real host networking in Docker Desktop as that is physically not possible. What Docker Desktop does is forwarding ports from the host to the virtual machine and from the container to the host. The documentation shows the limitations of the host network feature:
The host network feature of Docker Desktop works on layer 4. This means that unlike with Docker on Linux, network protocols that operate below TCP or UDP are not supported.
This feature doesnât work with Enhanced Container Isolation enabled, since isolating your containers from the host and allowing them access to the host network contradict each other.
IPv6 is not yet supported. Services need to use IPv4 and bind to address 127.0.0.1 in the container to be visible on the host.