When you run a container and check the mounted folders you will see the disk mounted into the container and the size of it in the list of mounted disks.
Docker Desktop on macOS can’t just mount the folders from the host directly into containers. There is a virtual machine and one more layer of containers (containerd) between the host and a Docker container so it has to do some magic to mount the folder to the virtual machine, then into the containerd container and from that you mount into a Docker container so it seems it will show you the size of the main disk of the Mac host where the /Volumes folder is.
For example when I list the disks on my Mac host, this is what I see
/dev/disk3s1s1 460Gi 9.2Gi 159Gi 6% 390k 1.7G 0% /
/dev/disk4s1 1.8Ti 896Gi 967Gi 49% 1 0 100% /Volumes/ta-exfat-2t
When I run a container and execute df in that,
docker run --rm -v /Volumes/ta-exfat-2t/Movies/files:/files ubuntu df -
this is what I see
/host_mark/Volumes 460.4G 301.7G 158.7G 66% /files
host_mark
comes from the containerd container, because this is how the folder is mounted from the virtual host which you can check this way:
docker run --rm --privileged --pid host ubuntu nsenter --all -t 1 \
-- ctr -n services.linuxkit task exec --exec-id test 02-docker \
df -h | grep host_mark
/host_mark/Users 461G 302G 159G 66% /host_mnt/Users
/host_mark/Volumes 461G 302G 159G 66% /host_mnt/Volumes
/host_mark/private 461G 302G 159G 66% /host_mnt/private
/host_mark/tmp 461G 302G 159G 66% /host_mnt/tmp
/host_mark/var/folders 461G 302G 159G 66% /host_mnt/var/folders
Then
docker run --rm --privileged --pid host ubuntu nsenter --all -t 1 \
-- ctr -n services.linuxkit task exec --exec-id test 02-docker \
ls -la /host_mnt
total 0
drwxr-xr-x 7 root root 140 Nov 18 21:02 .
drwxr-xr-x 1 root root 1440 Nov 18 21:02 ..
drwxr-xr-x 5 root root 160 Nov 1 22:50 Users
drwxr-xr-x 4 root root 128 Nov 19 13:51 Volumes
drwxr-xr-x 6 root root 192 Nov 16 20:32 private
drwxrwxrwt 21 root root 672 Nov 19 11:58 tmp
drwxr-xr-x 3 root root 60 Nov 18 21:02 var
Your docker commands will be converted to mount the folders properly from the containerd container (currently) called “02-docker”, but when you run docker container inspect
you will still see the host folder because the response will be converted too. You can check it this way if you have “jq” installed on Mac:
## in my case:
# docker run -d -v /Volumes/ta-exfat-2t/Movies/files:/files --name volume-test nginx
# in your case
docker run -d -v “/Volumes/eVault/ROM Database/Sony/PS2”:/mnt/ps2games --name volume-test nginx
Then run
container="volume-test"
container_original_config="$(dirname $(docker container inspect "$container" --format '{{ .LogPath }}'))/config.v2.json"
docker run --rm --privileged --pid host ubuntu nsenter --all -t 1 \
-- ctr -n services.linuxkit task exec --exec-id test 02-docker \
cat "$container_original_config" \
| jq .MountPoints
This is what I see:
{
"/files": {
"Source": "/host_mnt/Volumes/ta-exfat-2t/files",
"Destination": "/files",
"RW": true,
"Name": "",
"Driver": "",
"Type": "bind",
"Propagation": "rprivate",
"Spec": {
"Type": "bind",
"Source": "/host_mnt/Volumes/ta-exfat-2t/files",
"Target": "/files"
},
"SkipMountpointCreation": false
}
}
I don’t know if this incorrect free space issue can be solved and if it can, whose job it would be. Docker or the developers of LinuxKit.