17

I'm currently running Docker 1.12.6 on Ubuntu 17.04, and I would like to know if all directories under /var/lib/docker should be included in my monthly backup (I backup everything under / with rsnapshot, and then set some exclude rules).

With Vagrant, for example, I exclude from the backup downloaded images and their resulting machines (.vagrant.d/boxes/ and .VirtualBox/Machines/), since they can be rebuilt anytime with their respective Vagrantfile.

I don't really understand how the /var/lib/docker directory structure works, though. It is like the following in my system:

# tree -L 2 -a -F --dirsfirst --noreport /var/lib/docker/
/var/lib/docker/
├── aufs/
│   ├── diff/
│   ├── layers/
│   └── mnt/
├── containers/
├── image/
│   └── aufs/
├── network/
│   └── files/
├── swarm/
├── tmp/
├── trust/
└── volumes/
    └── metadata.db
admirabilis
  • 2,290
  • 2
  • 18
  • 33

1 Answers1

2

Yes, all directories under /var/lib/docker should be included in backup.

A Docker container consists of network settings, volumes, and images. The location of Docker files depends on your operating system.

Here is an overview for the most used operating systems:

  • Ubuntu, Fedora and Debian: /var/lib/docker/
  • Windows: C:\ProgramData\DockerDesktop
  • MacOS: ~/Library/Containers/com.docker.docker/Data/vms/0/

(In macOS and Windows, Docker runs Linux containers in a virtual environment.)

Note

When you upgraded the kernel, without installing an updated version of the aufs kernel module; in that case, the daemon will refuse to start with a message that the "previously used storage driver is not supported". If the daemon fails to start, always read the logs before you take action.

To resolve this, make sure you have the aufs kernel module installed, for example, as explained in the installation docs for Ubuntu.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
aryanveer
  • 628
  • 1
  • 6
  • 17