Why docker build is so slow

Not sure if this was the same problem but just made my build go from 5 minutes to 5 seconds, by adding the following .dockerignore file to the same directory as my docker-compose.yml file.

**/bin
**/obj
**/node_modules
.git

This sounds like your laptops btrfs filesystem is having issues - as in its fragmented. Try looking into tuning btrfs. I would also look into this section of the docker documentation related to docker and btrfs https://docs.docker.com/engine/userguide/storagedriver/btrfs-driver - specifically the section on performance which points to fragmentation.