From the 18.03 docs:
I want to connect from a container to a service on the host
The host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name
host.docker.internal, which resolves to the internal IP address used by the host.The gateway is also reachable as
gateway.docker.internal.
EXAMPLE:
Here’s what I use for my MySQL connection string inside my container to access the MySQL instance on my host:
mysql://host.docker.internal:3306/my_awesome_database