I also had the same problem on docker running on wsl ubuntu, so the problem was of dns resolution and i created /etc/docker/daemon.json file and added in it "dns": ["8.8.8.8", "8.8.4.4"] and then restarted docker and the issue was resolved.