I solved the problem by cleaning up dangling volumes. I referred to this thread on stackoverflow:
https://stackoverflow.com/questions/30604846/docker-error-no-space-left-on-device#:~:text=Check%20that%20you%20have%20free,var%2Flib%2Fdocker).&text=If%20you%20edit%20%2Fetc%2Fdefault,the%20change%20to%20take%20effect.