Just use host.docker.internal instead of localhost.
To make it work on Linux, you just need to start your Docker container passing the parameter --add-host host.docker.internal:host-gateway
Just use host.docker.internal instead of localhost.
To make it work on Linux, you just need to start your Docker container passing the parameter --add-host host.docker.internal:host-gateway