Mismatch in Docker size reported by du vs ls

I am on a Mac and have installed Docker Desktop for Mac. This is what I see:

ls -al ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
-rw-r–r–@ 1 xxx staff 63999836160 Apr 28 14:08 /Users/xxx/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

After checking 3 times, 63999836160 is 63,999,836,160 or 64GB if I am not mistaken.

But if I run du this is what I get:

$ du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/data/
6.5G /Users/xxx/Library/Containers/com.docker.docker/Data/vms/0/data/

This is a difference of 10x. What’s going on here?

Two different commands measuring two different things. Run this in the terminal:

open ~/Library/Containers/com.docker.docker/Data/vms/0/data/

In Finder right click on the disk image file (open the context menu) and click “Get info” a size in bytes and another in parenthesis which is the size on the disk. “du” is “disk usage”. It measures the used disk space and the disk image file is dinamically growing. The other size is the one until the file can grow and what the virtual machine inside “thinks” it can use. The size in the parenthesis can be different from the one you see in the output of du, because du uses units based on powers of 1024 unless you add --si (powers of 1000) to the options while Finder shows this automaically.