'Cannot pull the project from Bitbucket (the project is with IP restrictions) while using Docker with WSL2 Ubuntu-20.04 Distro

I've a Symfony project that I am running on my PC with Symfony serve.

This project is on Bitbucket that has IP restrictions, I can only work from home and nowhere else for security reasons, and all works just fine :).

I wanted to create a Docker image so that I can easily change my machine and be able to deploy it elsewhere.

So I created a Docker image and did the necesseray configurations and all seems good, I can open the project and work the same way as before. The Docker has the default WSL (WSL1) and I've noticed that the application isn't running as fast as usual (outside the Docker, to load a page it would take 3 seconds, while with Docker it takes at least 30 seconds).

I did some research and found out that I could use the WSL2 with DOCKER which provides better performance than the legacy Hyper-V Backend and Enabled integration for the distro UBUNTU-20.4. The problem using the WSL2 is that I am no longer able to pull my project in the WSL2 (from the Ubuntu-20.0) because of the IP restrictions.

It is really strange that I cannot find any configuration for this and I have no idea what should I do to change it. If I pull the project outside the WLS2 distro it works, with the default WSL it works also but not with the WSL2.

I removed the IP restrcitions and the Docker image worked fine, I have the same speed as If I was outside the Docker. The only problem is that I cannot use the IP restrcitoins for this !

Does anyone know how to fix this ? I haven't been able to find any documentation for this issue.

I am using Windows 10 and the Docker version : 4.5.1 (74721)

Thanks a lot for any information.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source