I am trying to run a docker compose file but I am receiving an error: npm ERR! request to http://npm.mydns.com:1555/@tmypackage-0.14.0.tgz failed, reason: connect EHOSTUNREACH 199.99.900.140:1555
However, it is working when I request from Postman, Browser, telnet the only requirement is ensure my company VPN is connected.
Looks like during code compilation in order to create the image, it is not considering retrieve npm packages using VPN. I am not sure how to ensure Docker for windows is using VPN connection.
It should use the default route of your host.
You can easily check it by using curl to access a page in your intranet.
I have a hunch: can you check the subnet wsl uses, and the routes that your vpn injects into your route table?
You can identify the wsl subnet in a Windows terminal, using the command ipconfig. The entry is called “Ethernet-Adapter vEthernet (WSL (Hyper-V firewall))”. It should tell you the first ip in the subnet and the netmask. You can enter these values in a subnet calculator like IP Subnet Calculator. For example my ipv4 address for this adapter is 172.30.80.1, and the netmask 255.255.240.0 (=20 bit netmask), which has a range from 172.30.80.1 - 172.30.95.254.
You can see the route table in a Windows terminal, using the command route print -4. Network targets that intersect with the ranges of the wsl subnet, but are routed through the vpn will cause problem.
You need to make sure both ranges do not intersect. I found a forum post that describes how to change the ip of the wsl2 network. Make sure to save the old settings sometwhere in case it doesn’t work.
You used 8 bits for the netmask, which translates to an ip range with 16777216 ips. The 20 bits netmask that was configured by default had 4096 ips in the range. So please pick subnet within one of these ranges that is colision free with the subnets of your routing table,and collision free with docker’s subnets ranges.
You might want to get in touch with your company’s it support and ask them for assistance. If the problem is related to your vpn, then it’s high likely you are not the only one affected, so that they already know what configuration works collision free.