Increase the amount of allocated memory to at least 4 GB.
Go to Docker > Preferences > Resources > Memory > Advanced. There drag memory slider to be at least 4 GB. You can also decrease swap size to its minimum value.
Also, you can increase the number of CPUs available for Docker.
By default, Docker Desktop is set to use half the number of processors available on the host machine. The more you set, the faster Docker containers will be.
Just note that the more CPUs you select, the fewer resources will be left for your system.