markdumay / synology-docker

An Unofficial Script to Update or Restore Docker Engine and Docker Compose on Synology
MIT License
178 stars 15 forks source link
docker synology

synology-docker

An Unofficial Script to Update or Restore Docker Engine and Docker Compose on Synology NAS

AboutBuilt WithPrerequisitesDeploymentUsageContributingCreditsDonateLicense

About

:warning: The repository 'Synology-Docker' is not supported by Synology and can potentially lead to malfunctioning of your NAS. Use this script at your own risk. Please keep a backup of your files.

Synology is a popular manufacturer of Network Attached Storage (NAS) devices. It provides a web-based user interface called Disk Station Manager (DSM). Synology also supports Docker on selected models. Docker is a lightweight virtualization application that gives you the ability to run containers directly on your NAS. The add-on package provided by Synology to install Docker is typically a version behind on the latest available version from Docker. Synology-Docker is a POSIX-compliant shell script to update both the Docker Engine and Docker Compose on your NAS to the latest version or a specified version.

Built With

The project uses Docker, a lightweight virtualization application.

Prerequisites

Synology-Docker runs on a Synology NAS with DSM 6 or DSM 7. The script has been tested with a DS918+ running DSM 6.2.4-25556 and DSM 7.0.1-42218. Other prerequisites are:

Deployment

Deployment of Synology-Docker is a matter of cloning the GitHub repository. Login to your NAS terminal via SSH first. Assuming you are in the working folder of your choice, clone the repository files. Git automatically creates a new folder synology-docker and copies the files to this directory. Then change your current folder to simplify the execution of the shell script.

$ git clone https://github.com/markdumay/synology-docker.git
$ cd synology-docker

Usage

Synology-Docker requires sudo rights. Use the following command to invoke Synology-Docker from the command line.

$ sudo ./syno_docker_update.sh [OPTIONS] COMMAND

Commands

Synology-Docker supports the following commands.

Command Argument Description
backup Create a backup of Docker binaries (including Docker Compose), dockerd configuration, and Synology's start-stop-status script
download PATH Download Docker and Docker Compose binaries to PATH
install PATH Update Docker and Docker Compose from files on PATH
restore Restore Docker and Docker Compose from a backup
update Update Docker and Docker Compose to a target version (creates a backup first)
Under the hood, the five different commands invoke a specific workflow or sequence of steps. The below table shows the workflows and the order of steps for each of the commands. # Workflow step backup download install restore update
A) Download Docker binary Step 1 Step 1
B) Download Compose binary Step 2 Step 2
C) Extract files from backup Step 1
D) Stop Docker daemon Step 1 Step 1 Step 2 Step 3
E) Backup current files Step 2 Step 2 Step 4
F) Extract downloaded binaries Step 3 Step 5
G) Restore Docker binaries Step 3
H) Install Docker binaries Step 4 Step 6
I) Update log driver Step 5 Step 7
J) Restore log driver Step 4
K) Update Docker script Step 5 Step 8
L) Restore Docker script Step 5
M) Start Docker daemon Step 3 Step 6 Step 6 Step 9
N) Clean temp folder Step 10

Options

Synology-Docker supports the following options.

Option Alias Argument Description
-b --backup NAME Name of the backup (defaults to docker_backup_YYMMDDHHMMSS.tgz)
-c --compose VERSION Specify the Docker Compose target version (defaults to latest available on github.com)
-d --docker VERSION Specify the Docker target version (defaults to latest available on docker.com)
-f --force Force the update and bypass compatibility check / confirmation check
-p --path Path of the backup (defaults to current directory)
-s --stage Stage only, do not replace binaries or the configuration of log driver

Known Issues

This link contains an overview of known issues, including available workarounds.

Contributing

  1. Clone the repository and create a new branch
    $ git checkout https://github.com/markdumay/synology-docker.git -b name_for_new_branch
  2. Make and test the changes
  3. Submit a Pull Request with a comprehensive description of the changes

Credits

Synology-Docker is inspired by this gist from Mikado8231.

Donate

Buy Me A Coffee

License

Copyright © Mark Dumay