Monday, March 29, 2021

Limit CPU/Memory When using Docker

After having trouble with the Singularity Pull command on a computing cluster, I decided it might be easier to download the image via Docker to my home machine and upload it from there. I tried it, but Docker turned out to be such a huge resource hog that it rendered my computer unusable. Okay, the thing to do is to limit the resources Docker is allowed; but a quick search seemed to indicate that, while plenty of people had the problem, the only thing to do was to not use virtual machines. Now that is great advice and I wholeheartedly endorse it; but sometimes it's inevitable. Eventually I got to an obscure SuperUser post that had an answer with zero upvotes that pointed to a blog post that explained what to do:

Summary: Limit the CPU's and memory available to WSL2 (Docker's underlying mechanism) via a config file. I'll want to remove those limitations pretty quickly as I use WSL pretty heavily, but until I get these few tasks completed at least this will allow me to keep using my machine.