How to exclude docker files from time machine backups
I don't need back up of my docker files. How do i exclude them from time machine backups
I see people mentioning /Users/david/Library/Containers/com.docker.docker folder but that does not exists on my machine.
Docker engine version: 20.10.2 running on Big Sur: 11.2
Update: Found the location
My virtual machine appears to be here. I added it to the list of folders to be excluded. However that folder is not shown in the Time Machine UI.
tmutil addexclusion /Users/david/Library/Containers/com.docker.docker/
Solution 1:
I use the generic addexclusion clause of tmutil
to make files not get backed up even if I move or copy them.
Open a Finder window to the files and a command line prompt (terminal.app is fine for this) and drag that file into the prompt after typing tmutil addexclusion
and press enter. Here you can see me checking files on the desktop of a user named mike...
mike@m1 ~ % tmutil isexcluded /Users/mike/Desktop/Docker\ Files
[Included] /System/Volumes/Data/Users/mike/Desktop/Docker Files
mike@m1 ~ % tmutil addexclusion /Users/mike/Desktop/Docker\ Files
mike@m1 ~ % tmutil isexcluded /Users/mike/Desktop/Docker\ Files
[Excluded] /System/Volumes/Data/Users/mike/Desktop/Docker Files
Solution 2:
There is a preference in Docker for this.
See screenshot from Docker Desktop 4.0.1:
From this SE posting and this Docker forum posting I learned that you can run the following command to see what is being excluded from Time Machine:
sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
When I run that command in my own Mac I find the following 2 exclusions listed:
/Users/user/Library/Containers/com.docker.docker/Data/vms/0/data
/Users/user/Library/Containers/com.docker.docker
The second directory listed there doesn't exist on my Mac but the former one includes a 64GB docker.raw file.
I am on Macos 11.6 Big Sur.
Despite all this I do find anecdotally that when I am running Docker my Time Machine backups are larger than when I am not running Docker, which makes me wonder if there are other locations that ought to be excluded but are not.