Docker won't build image for linux/amd64 - Memory leakage

I am trying to build an image for linux/amd64 platform. Currently, I am using Mac m1 with Docker Desktop for m1 installed in it. I have used the

experimental feature

of Docker Desktop but somehow it breaks my network settings and I am not able to pull images from docker hub. After, disabling the experimental feature I was able to download images but in the end it is giving me the following error:

#10 0.161
#10 0.161 #
#10 0.161 # Fatal process OOM in Failed to reserve virtual memory for CodeRange
#10 0.161 #
#10 0.161
#10 0.161 qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
#10 0.165 Trace/breakpoint trap```


I was going through the this issue: https://github.com/docker/for-mac/issues/5831 which is somehow similar to my situation and tried everything mentioned in it but nothing works for me. If someone here have faced similar issue or have any idea about how to fix this that would be a great help for me.

Thanks.

I was going through the this issue: Docker build fails when targeting `--platform linux/amd64`, due to `allocate virtual memory` issue · Issue #5831 · docker/for-mac · GitHub which is somehow similar to my situation and tried everything mentioned in it but nothing works for me. If someone here have faced similar issue or have any idea about how to fix this that would be a great help for me.

Thanks.

I was going through the this issue: Docker build fails when targeting `--platform linux/amd64`, due to `allocate virtual memory` issue · Issue #5831 · docker/for-mac · GitHub which is somehow similar to my situation and tried everything mentioned in it but nothing works for me. If someone here have faced similar issue or have any idea about how to fix this that would be a great help for me.

Thanks.