5

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/

3
  • Docker's not something I'm using on Big Sur - so you might need someone to help you find the folder they are dropped if the docker GUI no longer lets you reveal them in Finder. I more generically use the storage tab of about this Mac - select manage - then use the Reduce Clutter - review files should expose any large files if docker has squirreled them away.
    – bmike
    Feb 21, 2021 at 20:00
  • My Docker file appears at this location in Big Sur: ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
    – Ezekiel
    Feb 21, 2021 at 20:02
  • I linked to a SO thread that used to show how to navigate - you should be able to test my command below and edit it / fix it or answer if you don't want to add the exclusion in the Time Machine GUI to add files to skip... Apple has a container tab in the Storage Management tool so it should show Docker container if it's large, too...
    – bmike
    Feb 21, 2021 at 20:03

2 Answers 2

9

There is a preference in Docker for this.

See screenshot from Docker Desktop 4.0.1:

Docker Desktop Preferences Screen Cap

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.

3

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...

bmike@m1 ~ % tmutil isexcluded /Users/bmike/Desktop/Docker\ Files 
[Included]    /System/Volumes/Data/Users/bmike/Desktop/Docker Files
bmike@m1 ~ % tmutil addexclusion /Users/bmike/Desktop/Docker\ Files 
bmike@m1 ~ % tmutil isexcluded /Users/bmike/Desktop/Docker\ Files   
[Excluded]    /System/Volumes/Data/Users/bmike/Desktop/Docker Files

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .