I was testing an application that use 4 different docker containers: Nginx, Mysql , Main app in Spring Boot and Redis on Windows and noticed that it was very slow compared to the same app running directly on multiple linux distributions.
For reference the Windows machine is running still Windows 10 and Docker Desktop 4.10.1 (82475) with WSL 2 integration with Ubuntu 20.04.
On windows every request to the application was taking around 5 seconds compared to the 300ms if running directly on linux.
The solution was very simple: move all the files that you need inside the Linux distribution of WSL2 and then run your docker or docker-compose commands directly on the wsl2 without using Docker Desktop.
You are going to be located in your mount of windows user:
maxx@hackerss:/mnt/c/Users/maxx$ pwd /mnt/c/Users/maxx
Go to your home and using the mount copy the folder with all your docker creation files:
maxx@hackerss:~$ cd /home/maxx/project-name maxx@hackerss:~$ cp -r /mnt/c/Users/maxx/folder-with-docker-info .
Create your docker:
maxx@hackerss:~/project-name$ docker-compose up