The Docker.raw file contains all of the things, Containers, Images, and Volumes.
An Image, as you said, is a minimal operating system, along with whatever software it runs/needs. When you run it, a Container is created which provides disk space for the image. Containers can be easily discarded, so you don’t want to store data that you will need long-term in there. The answer to that, is to map folders within the Image to folders on your actual drive on you Mac. Use the -v command for that. When you run the Image, the folder in the Container becomes connected to the folder on your drive, and the Container uses it transparently.
I do this to process fMRI data. There is an image called niprep/fmriprep that I use.
As @mina said, I have this command that runs the Image with the appropriate folder mappings.
docker run -ti --rm \
-v /Volumes/fMRI/aim2/BIDS:/data:ro \
-v /Volumes/fMRI/aim2/BIDS/derivatives:/out \
-v /Volumes/fMRI/aim2/BIDS/work:/work \
/data /out/fmriprep-20.2.6 \
This runs the docker Image and maps
/data within the Container, and makes it read only (the :ro option).
It also maps
/out (again, in the Container), and
/work (in the Container).
The Image to run is specified on the next line
/out folders are specified as where the data will come from and be saved to, the subject
sub-001 is specified, then the work folder is specified.
There are also ways to run an Image and run a shell so that you get a
# prompt in the OS running in the container. So if I do that with the above command, then do
ls -l on the /data folder, I actually see the contents of
Containers can also run various servers, such as a web server, or a jupyter notebooks server.
One caveat: With Monterey installed, I found that my iMac Pro would shutdown without error or warning if I left Docker (or VMWare) running while I walked away for a while. I moved back to Big Sur, and everything is fine.