Skip to main content

Backup Docker Containers using Resilio Sync

Resilio Sync is a proprietary peer-to-peer file synchronization tool available for Windows, Mac, Linux, Android, iOS, Windows Phone, Amazon Kindle Fire and BSD.

Resilio Sync can be used to copy your docker container files from one machine to another either locally or anywhere in the world. You will need to install Resilio Sync on both machines. My Docker host is on a VM and the backups are sent to my Synology NAS which also runs Resilio Sync. For Synology users, Resilio Sync can be installed as a Package or as a Docker container. I prefer the Docker container but both will work. For the Docker host machine I only use... well, the docker container of-course.

One thing to note is Resilio Sync is NOT a backup tool but a syncing tool. Whatever your host machine pulls in, your backup machine will too. Keep that in mind when it comes to downloading files that you have no idea might contain threats to your system.

Install Resilio Sync

Install the LinuxServer Resilio Sync Docker container on your Docker host. I use this compose file.

version: "2.1"
    image: linuxserver/resilio-sync
    container_name: resilio-sync
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - UMASK_SET=022
      - path to config:/config
      - path to downloads:/downloads
      - /:/sync
      - 8888:8888
      - 55555:55555
    restart: unless-stopped

I prefer Compose because I use Portainer and Yacht to control my stacks.

Make changes to the ports, IDs and volumes as needed. Notice I bind "/" to"/sync", this allows you to browse your whole machine for folders to sync.

Repeat the same process on your Docker Backup machine.

Setup Resilio Sync

When you first load the UI you will be prompted to setup a username and password. Then assign a machine name. This name will be used so you can identify which machine is syncing to the folders you share. It's good if you have multiple machines syncing files.

Now on your Docker host Resilio Sync instance, you need to add a folder to share out. This should be the folder where you store your Docker container/s.

Click the plus in the upper left and add a standard folder.

My container files happen to be in my root directory. This is where my Wordpress files are stored for my Wordpress container.

Select the folder then click open. You will get a prompt to share your folder. Close that because we are not ready to do that yet.

Before we share anything we need to go to our backup machine and create a folder where the files will be synced. In my case, this is my Synology NAS. I created a new share and this is where all my Docker backups will sync to.

I created a new folder called Family Portal and that is where I want the files from my Docker host to go to. Now it's time to sync the filse from your host to your backup machine.

Go back to your Docker host Resilio Sync instance and right click om the folder you just setup and click the share option.

This will give you some different ways to sync your files to the backup machine.

I like to do "read only" syncing because this will make it so the backup machine cannot delete files from the host machine. So if you accidentally delete the files on your backup machine it wont delete them on the host machine too! Once you've made that mistake it only takes one time before you use read only lol.

Click on Key and copy the Read Only link then go back to your backup machine instance of Resilio Sync.

Click on the plus icon in the upper left corner again and this time click on Enter a key or link.

A new window will pop up where you enter the key and press ok. Then you need to browse for the folder you made on your backup machine to sync the files. I made the Family Portal folder so that's the folder I chose. Then click open.

Your files should now begin downloading to the backup machine and will do so every time a new file is added or changed.

Resilio Sync is very low maintenance. It's pretty much set it and forget it. However, it's always good to peek in and make sure your connections are still working from time to time.