There are certain features, like JavaScript service workers without https, that only work on localhost, but when I run my app inside a docker container, using docker-compose
Editing your hosts file causes that your local machine only looks directly to the IP address specified for a domain. So, you could add the ip address of the docker-machine to the etc\hosts file in your local machine and map the port 80 on your container to the port 80 on the docker-machine.
Example:
1) Get docker host ip address
$ docker-machine ip default
192.168.99.100
2) Add this line to etc/hosts file in your local machine 
192.168.99.100 domain.com
3) Check that your machine is resolving the domain.
$ ping domain.com
PING domain.com (192.168.99.100): 56 data bytes
64 bytes from 192.168.99.100: icmp_seq=0 ttl=64 time=0.294 ms
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.437 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.556 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.270 ms
Notes:
C:\Windows\System32\Drivers\etc\hosts