So you are using Docker Desktop for Windows, and your proxy is running on Windows as well.
Is 172.17.42.1 the wsl gateway ip, the windows host ip or something else?
Also, it’s important to know whether you are connected to a vpn or not - vpn connections have the tendency to block traffic from the wsl network to the host, and to modify routes that interfere with traffic to wsl.
In which wsl distribution do you run your command, is it docker-desktop or something else like ubuntu or a different distribution?
I use docker-engine, not docker desktop. 172.17.42.1 is docker gateway.
By the way, I found the key point. I didn’t add my user to docker user group (so use docker by sudo docker). This leads to my config.json at /root/.docker/config.json rather than ~/.docker/config.json