Duplicati

Introduction

Duplicati is a backup client that securely stores encrypted, incremental, compressed remote backups of local files on cloud storage services and remote file servers. Duplicati supports not only various online backup services like OneDrive, Amazon S3, Backblaze, Rackspace Cloud Files, Tahoe LAFS, and Google Drive, but also any servers that support SSH/SFTP, WebDAV, or FTP. Duplicati uses standard components such as rdiff, zip, AESCrypt, and GnuPG.

The Docker Compose File

---
version: "3.8"

services:
  duplicati:
    image: ghcr.io/linuxserver/duplicati:latest
    container_name: duplicati
    hostname: duplicati
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    environment:
      - TZ=${TZ}
      - PUID=${PUID}
      - PGID=${PGID}
    ports:
      - 8200:8200
    volumes:
      - /opt/duplicati/backups:/backups
      - /opt/duplicati/config:/config
      - /:/source
      - /etc/localtime:/etc/localtime:ro
    labels:
      - com.centurylinklabs.watchtower.enable=true

docker-compose.yml

The Docker Environment Variables File

TZ=Europe/Stockholm
PUID=1000
PGID=1000

.env

This Docker Compose file defines a single service named “duplicati”. The service is built from the “ghcr.io/linuxserver/duplicati:latest” Docker image, which is the latest version available. The container name is set to “duplicati” as well.

The “restart” section ensures that the container will always be restarted if it exits (unless manually stopped). This is useful for ensuring that the service is always available, especially if it crashes or is shut down unexpectedly.

The “security_opt” section prevents your container processes from gaining additional privileges. This is an important security consideration.

The “ports” section maps port 8200 on the host machine to port 8200 in the container. This allows us to access the Duplicati web interface from our local machine. By default, Duplicati runs on port 8200, but you can change it if necessary.

The “volumes” section maps the “/config” directory inside the container to a local directory on the host machine. This allows us to persist data across container restarts. Duplicati stores all its configuration and monitoring data in this directory, so it’s important to keep it intact. We also map the “/source” directory to a location on the host.

The "labels" section allows the Watchtower service to keep this container update automatically.

Running Duplicati with Docker Compose

To run Duplicati with Docker Compose, first, make sure you have Docker and Docker Compose installed on your machine. Then, create a new directory for your project and save the above Docker Compose file as “docker-compose.yml” in that directory.

Next, run the following command from the same directory:

docker compose up -d

This command will start the Duplicati container in the background and detach from it. You can then access the Duplicati web interface by going to http://localhost:8200 in your web browser.

Conclusion

In this article, we explored how to set up and run the Duplicati software using Docker Compose. We looked at the different sections of the Docker Compose file and explained how they work together to create a functional Duplicati service. By running Duplicati with Docker Compose, you can easily deploy and manage the tool on your own server, without having to worry about dependencies or configuration.


GitHub - duplicati/duplicati: Store securely encrypted backups in the cloud!
Store securely encrypted backups in the cloud! Contribute to duplicati/duplicati development by creating an account on GitHub.