Nyx Backup on a NAS (Docker)

From 1.1.4 Nyx Backup comes as a container image, nyxbackup/nyxbackup, for NAS boxes that run Docker: Synology (Container Manager), QNAP (Container Station), Unraid, TrueNAS SCALE (24.10 and later) and OpenMediaVault (the compose plugin). The NAS backs up its own shares, on a schedule, with no computer left on.

The image holds the background service and the two terminal tools (nyx_bkp_tui and nyx_bkp_cli), the same programs as the Linux packages, for Intel/AMD (amd64) and 64-bit ARM (arm64) NAS boxes. Docker picks the right one. 32-bit ARM NAS boxes cannot run it. A Raspberry Pi 4 or 5 on the 64-bit Raspberry Pi OS runs it too, with the same compose file.

There is no web interface. You set it up and manage it from a terminal, over SSH to the NAS, exactly as on a headless server. The desktop apps cannot manage it: the service only takes commands from inside its own container.

Two other ways to cover a NAS work without Docker, and still do:

  • Back up the NAS from a computer - add its shares as sources in a backup set on a computer that can reach them.
  • Use the NAS as a destination - back up your computers to it over SMB, SFTP or WebDAV. See Connecting storage.

What to keep, and what to mount

The container keeps everything that matters in three folders. Each must be a folder on the NAS (a bind mount), or it is lost when the container is recreated for an update:

In the containerHoldsIf you lose it
/etc/nyxbackupsettings, backup sets, exclusion rulesthe sets are gone and the computer’s license seat with them
/var/lib/nyxbackupthe encryption key, storage credentials, the local databaseyou need your recovery passphrase to read your backups again
/var/log/nyxbackupthe logsonly the logs

Then mount each share you want to back up, and each folder you want to restore into, at the same path as on the NAS:

- /volume1/photos:/volume1/photos

Nyx Backup records paths as the container sees them. With the same path on both sides, snapshots, search results and restores show the paths you know, and a restore to the original location lands where the files came from. Add :ro to a share’s line if you never want anything restored into it.

Set TZ to your time zone. A container runs on UTC unless told otherwise, and schedules use local time: without TZ a 2 AM backup runs at 2 AM UTC. The service logs the zone it is using when it starts.

Set stop_grace_period: 10m. When the container stops, Nyx Backup pauses a running backup where it is (the next start resumes it) and lets a running restore finish. Docker’s own default waits only 10 seconds before it kills the container.

Compose files

Each file below is complete. Change the paths to your own shares and TZ to your time zone. Create the three folders for the container’s own data before you start it.

Synology (Container Manager)

In File Station, create docker/nyxbackup with three folders inside it: config, state and logs. Container Manager does not create missing folders for you. Then in Container Manager, open Project, choose Create, set the path to /volume1/docker/nyxbackup, and paste:

services:
  nyxbackup:
    image: nyxbackup/nyxbackup:latest
    container_name: nyxbackup
    restart: unless-stopped
    stop_grace_period: 10m
    environment:
      - TZ=America/New_York
    volumes:
      - /volume1/docker/nyxbackup/config:/etc/nyxbackup
      - /volume1/docker/nyxbackup/state:/var/lib/nyxbackup
      - /volume1/docker/nyxbackup/logs:/var/log/nyxbackup
      - /volume1/photos:/volume1/photos
      - /volume1/documents:/volume1/documents

Commands on a Synology need sudo in front of docker.

QNAP (Container Station)

In Container Station, choose Create, then Create Application, give it the name nyxbackup, and paste:

services:
  nyxbackup:
    image: nyxbackup/nyxbackup:latest
    container_name: nyxbackup
    restart: unless-stopped
    stop_grace_period: 10m
    environment:
      - TZ=Europe/Berlin
    volumes:
      - /share/Container/nyxbackup/config:/etc/nyxbackup
      - /share/Container/nyxbackup/state:/var/lib/nyxbackup
      - /share/Container/nyxbackup/logs:/var/log/nyxbackup
      - /share/Photos:/share/Photos
      - /share/Documents:/share/Documents

Unraid

Use the Docker Compose Manager plugin from Community Applications with this file, or the docker run line after it from the Unraid terminal. Either way the container then shows on the Docker tab.

services:
  nyxbackup:
    image: nyxbackup/nyxbackup:latest
    container_name: nyxbackup
    restart: unless-stopped
    stop_grace_period: 10m
    environment:
      - TZ=America/Chicago
    volumes:
      - /mnt/user/appdata/nyxbackup/config:/etc/nyxbackup
      - /mnt/user/appdata/nyxbackup/state:/var/lib/nyxbackup
      - /mnt/user/appdata/nyxbackup/logs:/var/log/nyxbackup
      - /mnt/user/photos:/mnt/user/photos
      - /mnt/user/documents:/mnt/user/documents
docker run -d --name nyxbackup --restart unless-stopped --stop-timeout 600 \
  -e TZ=America/Chicago \
  -v /mnt/user/appdata/nyxbackup/config:/etc/nyxbackup \
  -v /mnt/user/appdata/nyxbackup/state:/var/lib/nyxbackup \
  -v /mnt/user/appdata/nyxbackup/logs:/var/log/nyxbackup \
  -v /mnt/user/photos:/mnt/user/photos \
  -v /mnt/user/documents:/mnt/user/documents \
  nyxbackup/nyxbackup:latest

TrueNAS SCALE (24.10 and later)

Create a dataset for the container’s data, for example tank/apps/nyxbackup, with config, state and logs folders in it. Then go to Apps, Discover Apps, open the menu at the top right, choose Install via YAML, name it nyxbackup, and paste:

services:
  nyxbackup:
    image: nyxbackup/nyxbackup:latest
    container_name: nyxbackup
    restart: unless-stopped
    stop_grace_period: 10m
    environment:
      - TZ=America/Los_Angeles
    volumes:
      - /mnt/tank/apps/nyxbackup/config:/etc/nyxbackup
      - /mnt/tank/apps/nyxbackup/state:/var/lib/nyxbackup
      - /mnt/tank/apps/nyxbackup/logs:/var/log/nyxbackup
      - /mnt/tank/photos:/mnt/tank/photos
      - /mnt/tank/documents:/mnt/tank/documents

TrueNAS removes comments from a file pasted there, so keep notes elsewhere.

OpenMediaVault (compose plugin)

With the openmediavault-compose plugin set up (its compose files folder is usually a shared folder called appdata), go to Services, Compose, Files, add a file named nyxbackup, and paste the file below. Replace DISK with your data disk’s folder under /srv - the path your shared folders show.

services:
  nyxbackup:
    image: nyxbackup/nyxbackup:latest
    container_name: nyxbackup
    restart: unless-stopped
    stop_grace_period: 10m
    environment:
      - TZ=Europe/London
    volumes:
      - /srv/DISK/appdata/nyxbackup/config:/etc/nyxbackup
      - /srv/DISK/appdata/nyxbackup/state:/var/lib/nyxbackup
      - /srv/DISK/appdata/nyxbackup/logs:/var/log/nyxbackup
      - /srv/DISK/photos:/srv/DISK/photos
      - /srv/DISK/documents:/srv/DISK/documents

First-time setup

Everything is done in the terminal interface inside the container. Start the container, connect to the NAS over SSH, and open it:

docker exec -it nyxbackup nyx_bkp_tui        # sudo docker ... on a Synology

1. The encryption key

The first screen creates the key that encrypts your backups:

  • Press G to generate a new key. Nyx Backup then shows your recovery passphrase once. Write it down and keep it away from the NAS: it is the only way to read your backups if the NAS or its state folder is lost.
  • Or press I to import the key your other computers already use, so they can all restore each other’s backups. See Encryption.

2. A backup set

Press 4 for Settings, then a to add a set:

  • Sources - the shares you mounted, at their NAS paths (for example /volume1/photos). F2 opens a folder picker.
  • Destination - a cloud service or another server: Amazon S3 or any S3-compatible service, Backblaze B2, Wasabi, Azure Blob, Google Cloud Storage, SFTP, SMB or WebDAV. F3 tests the connection. Google Drive, Dropbox and OneDrive sign in through a web browser, which a container does not have.
  • Schedule and retention - when it runs and how long snapshots are kept. Add a health-check ping URL here too (see below).

Tab and Shift+Tab move between fields, Enter saves. Then press 1 for the Dashboard and b to run the first backup. The headless guide lists every key.

3. The license

Put your nyxbackup.lic file into the container’s config folder from the NAS’s file manager - for example /volume1/docker/nyxbackup/config on a Synology. The container sees that folder as /etc/nyxbackup. Then in the terminal interface press 5 for the License tab, then a, type /etc/nyxbackup/nyxbackup.lic and press Enter. The license verifies offline.

Or from the command line, with the file anywhere on the NAS:

docker cp nyxbackup.lic nyxbackup:/tmp/nyxbackup.lic
docker exec nyxbackup nyx_bkp_cli license activate /tmp/nyxbackup.lic

One container counts as one computer for your license. It keeps its seat for as long as you keep its /etc/nyxbackup folder, through every update.

Restoring

Press 3 for Snapshots, choose a snapshot and press r, then type the folder to restore into and press Enter. It must be a folder you mounted into the container (for example /volume1/restore): any other path, such as /tmp or /root, is inside the container, where you cannot see it and where it is lost when the container is recreated. Press o or Space first to put back the original owners and permissions.

The command line works too, prefixed with docker exec nyxbackup:

docker exec nyxbackup nyx_bkp_cli status
docker exec nyxbackup nyx_bkp_cli backup "Photos"
docker exec nyxbackup nyx_bkp_cli restore "Photos" /volume1/restore

A restore keeps the source folder’s own name: restoring the Photos set’s /volume1/photos into /volume1/restore gives /volume1/restore/photos/.... The folder you restore into must be mounted in the container too.

Knowing when something is wrong

A container has no desktop, so Nyx Backup cannot show a notification when a backup fails. Set up one of these in the backup set instead (all described in Monitoring and alerts):

  • a health-check ping URL - a monitoring service warns you when the ping stops arriving or reports a failure;
  • an email alert;
  • a hook script that runs when a backup fails.

docker ps shows the container as healthy while the service answers, and docker logs nyxbackup shows the service log.

Updating

Nyx Backup never updates itself in a container. When a new version is out, nyx_bkp_cli check-update says so and names the image to pull. Pull it and recreate the container - your three folders carry everything across:

docker compose pull && docker compose up -d

On Synology, QNAP, TrueNAS and OpenMediaVault the project or application page has the same pull-and-recreate action. Use :latest to follow each release, or a version tag such as nyxbackup/nyxbackup:1.1.4 to choose when you move.

To hear about a new version without asking:

  • Synology Container Manager, Unraid, TrueNAS and Portainer show an update badge on a container whose :latest image has a newer version.
  • The service checks once a day and writes the version and the command to its log (/var/log/nyxbackup in your logs folder).
  • An automatic updater such as Watchtower can pull and recreate the container for you. With stop_grace_period: 10m a backup it interrupts is paused, and the new container resumes it.

Each new image brings the default exclusion rules up to date in /etc/nyxbackup/exclusions. Keep rules of your own in /etc/nyxbackup/exclusions.d - an update never touches that folder.

Checking the image’s signature

Each release’s image is signed. To check that the image you pulled is the one Nyx Software built, with cosign:

cosign verify --key https://nyxbackup.com/keys/cosign.pub nyxbackup/nyxbackup:1.1.4

Btrfs snapshots (optional)

By default the container reads your files directly, as they are while the backup runs. A file that changes in the middle of a backup can be saved part-way through its change; the next backup saves it again.

On a Btrfs volume (Synology shares are Btrfs subvolumes) Nyx Backup can instead take a snapshot of the share and read that, so every file is saved as it was at one moment. Creating a snapshot needs an extra privilege, which is off by default because it lets the container do much more than read files. To allow it, add this under the nyxbackup service:

    cap_add:
      - SYS_ADMIN

Without it, nothing fails: the backup reads the files directly.

Things to know

  • USB disks. Docker mounts a folder when the container starts. If a USB disk is not plugged in at that moment, the container gets the empty folder underneath it, and a backup to that folder lands on the NAS’s own disk. Prefer a cloud or network destination; if you use a USB disk, keep it plugged in and restart the container after you reconnect it.
  • The encryption key at rest. On a normal computer the key is kept in the system’s key store; in a container there is none, so it is a file only root can read, in the state folder. The service says so in a warning each time it starts. Keep that folder on an encrypted shared folder if your NAS offers one, and keep your recovery passphrase somewhere else.
  • Permissions. The service runs as root inside the container, so it can read every file you mount and restore owners and permissions. On a Synology, file access rules set in DSM (ACLs) are kept by DSM, not by the container.
  • Moving to a normal install later. Because the paths are the same, a Linux computer with the regular package can restore these snapshots with the paths you know. See Restoring from another computer.