From f03462799fb33d7836e96919fb9f1be2e7e220a9 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Sun, 5 May 2024 01:37:44 -0500 Subject: [PATCH 01/22] modified for DSM 7.2 and default to local logger --- syno_docker_update.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/syno_docker_update.sh b/syno_docker_update.sh index 5e78617..a8d9e40 100755 --- a/syno_docker_update.sh +++ b/syno_docker_update.sh @@ -27,9 +27,9 @@ readonly DOWNLOAD_DOCKER="https://download.docker.com/linux/static/stable/${CPU_ readonly DOWNLOAD_GITHUB='https://github.com/docker/compose' readonly GITHUB_API_COMPOSE='https://api.github.com/repos/docker/compose/releases/latest' readonly SYNO_DOCKER_SERV_NAME6='pkgctl-Docker' -readonly SYNO_DOCKER_SERV_NAME7='Docker' +readonly SYNO_DOCKER_SERV_NAME7='ContainerManager' readonly SYNO_SERVICE_TIMEOUT='5m' -readonly SYNO_DOCKER_DIR='/var/packages/Docker' +readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' readonly SYNO_DOCKER_BIN_PATH="${SYNO_DOCKER_DIR}/target/usr" readonly SYNO_DOCKER_BIN="${SYNO_DOCKER_BIN_PATH}/bin" readonly SYNO_DOCKER_SCRIPT_PATH="${SYNO_DOCKER_DIR}/scripts" @@ -38,7 +38,11 @@ readonly SYNO_DOCKER_JSON_PATH="${SYNO_DOCKER_DIR}/etc" readonly SYNO_DOCKER_JSON="${SYNO_DOCKER_JSON_PATH}/dockerd.json" readonly SYNO_DOCKER_JSON_CONFIG="{ \"data-root\" : \"$SYNO_DOCKER_DIR/target/docker\", - \"log-driver\" : \"json-file\", + \"log-driver\" : \"local\", + \"log-opts\" : { + \"max-size\" : \"10m\", + \"max-file\" : \"3\" + }, \"registry-mirrors\" : [], \"group\": \"administrators\" }" @@ -1133,4 +1137,4 @@ main() { echo "Done." } -main "$@" \ No newline at end of file +main "$@" From b7b0bdcdc54da5f1358cc79ea150e6cd0d51f7c4 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Sun, 5 May 2024 01:54:09 -0500 Subject: [PATCH 02/22] updated README regarding logging driver --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f38427c..24783de 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ Under the hood, the five different commands invoke a specific workflow or sequen * **F) Extract downloaded binaries** - Extracts the files from a downloaded archive to the temp directory (`/tmp/docker_update`). * **G) Restore Docker binaries** - Restores the Docker binaries in `/var/packages/Docker/target/usr/bin/*` with the binaries extracted from a backup archive. * **H) Install Docker binaries** - Installs downloaded and extracted Docker binaries (including Docker Compose) to the folder `/var/packages/Docker/target/usr/bin/`. -* **I) Update log driver** - Replaces Synology's log driver with a default log driver `json-file` to improve compatibility. The configuration is updated at `/var/packages/Docker/etc/dockerd.json` +* **I) Update log driver** - Replaces Synology's log driver with a default log driver `local` to improve compatibility while optimizing writes and limiting log file growth. The configuration is updated at `/var/packages/Docker/etc/dockerd.json` * **J) Restore log driver** - Restores the log driver (`/var/packages/Docker/etc/dockerd.json`) from the configuration within a backup archive. * **K) Update Docker script** - Updates Synology's `start-stop-status` script for Docker to enable IP forwarding. This ensures containers can be properly reached in bridge networking mode. The script is updated at the location `/var/packages/Docker/scripts/start-stop-status`. * **L) Restore Docker script** - Restores the `start-stop-status` script (`/var/packages/Docker/scripts/start-stop-status`) from the file within a backup archive. -* **M) Start Docker daemon** - Starts the Docker daemon by invoking `synoservicectl --start pkgctl-Docker`. +* **M) Start Docker daemon** - Starts the Docker daemon by invoking `synoservicectl --start pkgctl-Docker` (or `synopkg start ContainerManager` on DSM 7). * **N) Clean temp folder** - Removes files from the temp directory (`/tmp/docker_update`). The temporary files are created when extracting a downloaded archive or extracting a backup. From c5510818f33f73818c1efde491171e77b3f5324a Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Sun, 5 May 2024 02:09:40 -0500 Subject: [PATCH 03/22] added conditional for Docker Directory, DSM6 vs DSM7 --- syno_docker_update.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/syno_docker_update.sh b/syno_docker_update.sh index a8d9e40..6d8f511 100755 --- a/syno_docker_update.sh +++ b/syno_docker_update.sh @@ -13,6 +13,19 @@ # Comments : Use this script at your own risk. Refer to the license for the warranty disclaimer. #====================================================================================================================== +#====================================================================================================================== +# Displays error message on console and terminates with non-zero error. +#====================================================================================================================== +# Arguments: +# $1 - Error message to display. +# Outputs: +# Writes error message to stderr, non-zero exit code. +#====================================================================================================================== +terminate() { + printf "${RED}${BOLD}%s${NC}\n" "ERROR: $1" + exit 1 +} + #====================================================================================================================== # Constants #====================================================================================================================== @@ -29,7 +42,11 @@ readonly GITHUB_API_COMPOSE='https://api.github.com/repos/docker/compose/release readonly SYNO_DOCKER_SERV_NAME6='pkgctl-Docker' readonly SYNO_DOCKER_SERV_NAME7='ContainerManager' readonly SYNO_SERVICE_TIMEOUT='5m' -readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' +[ -d "/var/packages/ContainerManager" ] && readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' +[ -d "/var/packages/Docker" ] && readonly SYNO_DOCKER_DIR='/var/packages/Docker' +if [ -z "$SYNO_DOCKER_DIR" ]; then + terminate "Docker (or ContainerManager) folder was not found." +fi readonly SYNO_DOCKER_BIN_PATH="${SYNO_DOCKER_DIR}/target/usr" readonly SYNO_DOCKER_BIN="${SYNO_DOCKER_BIN_PATH}/bin" readonly SYNO_DOCKER_SCRIPT_PATH="${SYNO_DOCKER_DIR}/scripts" @@ -107,19 +124,6 @@ usage() { echo } -#====================================================================================================================== -# Displays error message on console and terminates with non-zero error. -#====================================================================================================================== -# Arguments: -# $1 - Error message to display. -# Outputs: -# Writes error message to stderr, non-zero exit code. -#====================================================================================================================== -terminate() { - printf "${RED}${BOLD}%s${NC}\n" "ERROR: $1" - exit 1 -} - #====================================================================================================================== # Print current progress to the console and shows progress against total number of steps. #====================================================================================================================== From fda9ec3697e25878bdca7bd46c82a4cddd98f39c Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Wed, 22 May 2024 22:44:41 -0500 Subject: [PATCH 04/22] Added "Preparation" section to README This additional section advises users to stop all containers with compose before upgrade or restores, in order to avoid the errors with persisted logging mechanisms still referring to the DB logging plugin from Synology. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 24783de..96e6a14 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,22 @@ $ cd synology-docker $ sudo ./syno_docker_update.sh [OPTIONS] COMMAND ``` +## Preparation before upgrade +If you're using *compose* for your containers, I highly recommend that before you run the upgrade (or restore, if you're going back to the original version) you go through and stop each running container. +```console +$ cd /volume1/docker/{my_container} +$ docker-compose down +``` +Because this upgrade modifies the default logger for docker, stopping (removing) and re-starting each container is required, since the logging mechanism is persisted during a compose docker build / start. You don't HAVE to do this before the upgrade, however if you don't, you'll get errors related to the logger for your containers, and will anyway have to stop and start each container / stack after the upgrade anyway. + +Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. + +For a convenient way of enumerating all of the running *compose* projects (you might see some duplicates if you're using compose projects with multiple containers), you can execute the following: + +```console +for c in `docker ps -q`; do docker inspect $c --format '{{index .Config.Labels "com.docker.compose.project.config_files"}}' ; done +``` + ### Commands *Synology-Docker* supports the following commands. From 56a6caeee7fc06e8bce69259f7ca1048ecd8b42b Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Wed, 22 May 2024 22:48:01 -0500 Subject: [PATCH 05/22] Update README.md remove dupes from compose enumeration --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 96e6a14..10f2656 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,12 @@ Because this upgrade modifies the default logger for docker, stopping (removing) Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. -For a convenient way of enumerating all of the running *compose* projects (you might see some duplicates if you're using compose projects with multiple containers), you can execute the following: +For a convenient way of enumerating all of the running *compose* projects, you can execute the following: ```console -for c in `docker ps -q`; do docker inspect $c --format '{{index .Config.Labels "com.docker.compose.project.config_files"}}' ; done +for c in `docker ps -q`; do \ + docker inspect $c --format '{{index .Config.Labels "com.docker.compose.project.config_files"}}' ; done \ + | sort -u ``` ### Commands From 33d2141c57c78e3705676770e78f0f4c25e82c6c Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Wed, 22 May 2024 23:40:54 -0500 Subject: [PATCH 06/22] Update README.md --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 10f2656..59f3f41 100644 --- a/README.md +++ b/README.md @@ -68,14 +68,6 @@ $ cd synology-docker ``` - -## Usage -*Synology-Docker* requires `sudo` rights. Use the following command to invoke *Synology-Docker* from the command line. - -```console -$ sudo ./syno_docker_update.sh [OPTIONS] COMMAND -``` - ## Preparation before upgrade If you're using *compose* for your containers, I highly recommend that before you run the upgrade (or restore, if you're going back to the original version) you go through and stop each running container. ```console @@ -94,6 +86,15 @@ for c in `docker ps -q`; do \ | sort -u ``` +## Usage +*Synology-Docker* requires `sudo` rights. Use the following command to invoke *Synology-Docker* from the command line. + +```console +$ sudo ./syno_docker_update.sh [OPTIONS] COMMAND +``` + + + ### Commands *Synology-Docker* supports the following commands. From cca1662c25c57ce9dc773789aea0eb9c11fd7063 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Thu, 23 May 2024 00:26:03 -0500 Subject: [PATCH 07/22] Update README.md modified command to identify compose-managed and non compose-managed containers --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 59f3f41..0fe6998 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ $ cd synology-docker ``` + ## Preparation before upgrade If you're using *compose* for your containers, I highly recommend that before you run the upgrade (or restore, if you're going back to the original version) you go through and stop each running container. ```console @@ -81,10 +82,15 @@ Stopping all the containers prior to the upgrade / restore will also make the up For a convenient way of enumerating all of the running *compose* projects, you can execute the following: ```console -for c in `docker ps -q`; do \ - docker inspect $c --format '{{index .Config.Labels "com.docker.compose.project.config_files"}}' ; done \ - | sort -u +for c in $(docker ps -q); do \ + docker inspect "$c" --format \ + '{{.Name}} {{if index .Config.Labels "com.docker.compose.project.config_files"}}{{index .Config.Labels "com.docker.compose.project.config_files"}}{{else}}!---not_managed_by_compose---!{{end}}'; \ +done \ +| sort -u -t " " -k 2 \ +| column -t -N Container,Compose_Location ``` +...if you see a container with `!---not_managed_by_compose---!` you'll need to make sure you know how to recreate this container after the upgrade. + ## Usage *Synology-Docker* requires `sudo` rights. Use the following command to invoke *Synology-Docker* from the command line. From fabd4a973b537aaad441ecf4e73a5cec6d76a082 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Thu, 23 May 2024 00:30:49 -0500 Subject: [PATCH 08/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fe6998..9f958a6 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ If you're using *compose* for your containers, I highly recommend that before yo $ cd /volume1/docker/{my_container} $ docker-compose down ``` -Because this upgrade modifies the default logger for docker, stopping (removing) and re-starting each container is required, since the logging mechanism is persisted during a compose docker build / start. You don't HAVE to do this before the upgrade, however if you don't, you'll get errors related to the logger for your containers, and will anyway have to stop and start each container / stack after the upgrade anyway. +Because this upgrade modifies the default logger for docker, stopping (removing) and re-starting each container is required, since the logging mechanism is persisted during a compose docker build / start. You don't HAVE to do this before the upgrade, however if you don't, you'll get errors related to the logger for your containers, and will have to stop and start each container / stack after the upgrade anyway. Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. From f6ae013c4fe94aa8292b01c0997a2d2b043b649e Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Sun, 26 May 2024 11:07:29 -0500 Subject: [PATCH 09/22] Update README.md include tested DSM version 7.2.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f958a6..9b9e7c4 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Detailed background information is available on the author's [personal blog][blo The project uses [Docker][docker_url], 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: +*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, DSM 7.0.1-42218, and DSM 7.2.1-69057. Other prerequisites are: * **SSH admin access is required** - *Synology-Docker* runs as a shell script on the terminal. You can enable SSH access in DSM under `Control Panel ➡ Terminal & SNMP ➡ Terminal`. From b2fd0818a8b312c3fb3a03b5357cdf8475b309d4 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Wed, 12 Jun 2024 05:08:10 -0500 Subject: [PATCH 10/22] updated for DSM 7.1.1 --- syno_docker_update.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/syno_docker_update.sh b/syno_docker_update.sh index 6d8f511..3a7f8de 100755 --- a/syno_docker_update.sh +++ b/syno_docker_update.sh @@ -39,11 +39,11 @@ readonly CPU_ARCH='x86_64' readonly DOWNLOAD_DOCKER="https://download.docker.com/linux/static/stable/${CPU_ARCH}" readonly DOWNLOAD_GITHUB='https://github.com/docker/compose' readonly GITHUB_API_COMPOSE='https://api.github.com/repos/docker/compose/releases/latest' -readonly SYNO_DOCKER_SERV_NAME6='pkgctl-Docker' -readonly SYNO_DOCKER_SERV_NAME7='ContainerManager' readonly SYNO_SERVICE_TIMEOUT='5m' -[ -d "/var/packages/ContainerManager" ] && readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' -[ -d "/var/packages/Docker" ] && readonly SYNO_DOCKER_DIR='/var/packages/Docker' +[ -d "/var/packages/ContainerManager" ] && readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' && \ + readonly SYNO_DOCKER_SERV_NAME='ContainerManager' +[ -d "/var/packages/Docker" ] && readonly SYNO_DOCKER_DIR='/var/packages/Docker' && \ + readonly SYNO_DOCKER_SERV_NAME='Docker' if [ -z "$SYNO_DOCKER_DIR" ]; then terminate "Docker (or ContainerManager) folder was not found." fi @@ -621,20 +621,20 @@ execute_stop_syno() { if [ "${stage}" = 'false' ] ; then case "${dsm_major_version}" in "6") - syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME6}" | grep running -o) + syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME}" | grep running -o) if [ "${syno_status}" = 'running' ] ; then - timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synoservicectl --stop "${SYNO_DOCKER_SERV_NAME6}" - syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME6}" | grep stop -o) + timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synoservicectl --stop "${SYNO_DOCKER_SERV_NAME}" + syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME}" | grep stop -o) if [ "${syno_status}" != 'stop' ] ; then terminate "Could not stop Docker daemon" fi fi ;; "7") - syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME7}" | grep started -o) + syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME}" | grep started -o) if [ "${syno_status}" = 'started' ] ; then - timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synopkg stop "${SYNO_DOCKER_SERV_NAME7}" - syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME7}" | grep stopped -o) + timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synopkg stop "${SYNO_DOCKER_SERV_NAME}" + syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME}" | grep stopped -o) if [ "${syno_status}" != 'stopped' ] ; then terminate "Could not stop Docker daemon" fi @@ -940,9 +940,9 @@ execute_start_syno() { if [ "${stage}" = 'false' ] ; then case "${dsm_major_version}" in "6") - timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synoservicectl --start "${SYNO_DOCKER_SERV_NAME6}" + timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synoservicectl --start "${SYNO_DOCKER_SERV_NAME}" - syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME6}" | grep running -o) + syno_status=$(synoservicectl --status "${SYNO_DOCKER_SERV_NAME}" | grep running -o) if [ "${syno_status}" != 'running' ] ; then if [ "${force}" != 'true' ] ; then terminate "Could not bring Docker Engine back online" @@ -952,9 +952,9 @@ execute_start_syno() { fi ;; "7") - timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synopkg start "${SYNO_DOCKER_SERV_NAME7}" + timeout --foreground "${SYNO_SERVICE_TIMEOUT}" synopkg start "${SYNO_DOCKER_SERV_NAME}" - syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME7}" | grep started -o) + syno_status=$(synopkg status "${SYNO_DOCKER_SERV_NAME}" | grep started -o) if [ "${syno_status}" != 'started' ] ; then if [ "${force}" != 'true' ] ; then terminate "Could not bring Docker Engine back online" From d9b4116cecf3e342f8fadfa47fd1f2f600adc941 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Wed, 12 Jun 2024 05:15:53 -0500 Subject: [PATCH 11/22] updated for DSM 7.1.1 --- syno_docker_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syno_docker_update.sh b/syno_docker_update.sh index 3a7f8de..3e72b1b 100755 --- a/syno_docker_update.sh +++ b/syno_docker_update.sh @@ -43,7 +43,7 @@ readonly SYNO_SERVICE_TIMEOUT='5m' [ -d "/var/packages/ContainerManager" ] && readonly SYNO_DOCKER_DIR='/var/packages/ContainerManager' && \ readonly SYNO_DOCKER_SERV_NAME='ContainerManager' [ -d "/var/packages/Docker" ] && readonly SYNO_DOCKER_DIR='/var/packages/Docker' && \ - readonly SYNO_DOCKER_SERV_NAME='Docker' + readonly SYNO_DOCKER_SERV_NAME='pkgctl-Docker' if [ -z "$SYNO_DOCKER_DIR" ]; then terminate "Docker (or ContainerManager) folder was not found." fi From 8335d675225bfb81dba5b089063b756085cce71d Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Tue, 23 Jul 2024 06:18:23 -0500 Subject: [PATCH 12/22] added script for enumerating containers --- syno_docker_list_containers.sh | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 syno_docker_list_containers.sh diff --git a/syno_docker_list_containers.sh b/syno_docker_list_containers.sh new file mode 100755 index 0000000..35289ab --- /dev/null +++ b/syno_docker_list_containers.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Store container information in an array +containers_info=() + +# Get the list of containers and their compose locations +for c in $(docker ps -q); do + container_info=$(docker inspect "$c" --format '{{.Name}} {{if index .Config.Labels "com.docker.compose.project.config_files"}}{{index .Config.Labels "com.docker.compose.project.config_files"}}{{else}}!---not_managed_by_compose---!{{end}}') + containers_info+=("$container_info") +done + +# Sort the array based on the second field (compose location) +IFS=$'\n' sorted_containers_info=($(printf "%s\n" "${containers_info[@]}" | sort -u -t " " -k 2)) + +# Calculate the maximum length for the container names and compose locations +max_container_length=0 +max_location_length=0 +for info in "${sorted_containers_info[@]}"; do + container=$(echo "$info" | awk '{print $1}') + location=$(echo "$info" | awk '{print $2}') + [ ${#container} -gt $max_container_length ] && max_container_length=${#container} + [ ${#location} -gt $max_location_length ] && max_location_length=${#location} +done + +# Print the header +printf "%-${max_container_length}s %s\n" "Container" "Compose_Location" +printf "%-${max_container_length}s %s\n" "$(printf '%*s' "${max_container_length}" | tr ' ' '-')" "$(printf '%*s' "${max_location_length}" | tr ' ' '-')" + +# Print the sorted container information +for info in "${sorted_containers_info[@]}"; do + container=$(echo "$info" | awk '{print $1}') + location=$(echo "$info" | sed -e 's/^[^ ]* //') + printf "%-${max_container_length}s %s\n" "$container" "$location" +done + From 7a5cd068b1879ff6e3820a3f588b0543c992e261 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Tue, 23 Jul 2024 06:21:33 -0500 Subject: [PATCH 13/22] updated to use script for listing containers, does not depend on column --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9b9e7c4..61da0fd 100644 --- a/README.md +++ b/README.md @@ -79,17 +79,9 @@ Because this upgrade modifies the default logger for docker, stopping (removing) Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. -For a convenient way of enumerating all of the running *compose* projects, you can execute the following: +For a convenient way of enumerating all of the running *compose* projects, run the script `syno_docker_list_containers.sh`: -```console -for c in $(docker ps -q); do \ - docker inspect "$c" --format \ - '{{.Name}} {{if index .Config.Labels "com.docker.compose.project.config_files"}}{{index .Config.Labels "com.docker.compose.project.config_files"}}{{else}}!---not_managed_by_compose---!{{end}}'; \ -done \ -| sort -u -t " " -k 2 \ -| column -t -N Container,Compose_Location -``` -...if you see a container with `!---not_managed_by_compose---!` you'll need to make sure you know how to recreate this container after the upgrade. +...if you see a container listed with `!---not_managed_by_compose---!` you'll need to make sure you know how to recreate this container after the upgrade. ## Usage From 4a2deb4efb57a24ab6d946eb4828e93d0a70fb6b Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Tue, 23 Jul 2024 06:24:16 -0500 Subject: [PATCH 14/22] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61da0fd..9a33663 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Because this upgrade modifies the default logger for docker, stopping (removing) Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. -For a convenient way of enumerating all of the running *compose* projects, run the script `syno_docker_list_containers.sh`: +For a convenient way of enumerating all of the running *compose* projects, run the script `syno_docker_list_containers.sh` ...if you see a container listed with `!---not_managed_by_compose---!` you'll need to make sure you know how to recreate this container after the upgrade. From ff4be0f693c2d138e576b84f938872cb0d62e358 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Tue, 23 Jul 2024 06:31:25 -0500 Subject: [PATCH 15/22] Update README.md to match master --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9a33663..6340e9e 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,8 @@ The project uses [Docker][docker_url], a lightweight virtualization application. 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. ```console -$ git clone https://github.com/markdumay/synology-docker.git -$ cd synology-docker +git clone https://github.com/telnetdoogie/synology-docker.git +cd synology-docker ``` @@ -72,27 +72,32 @@ $ cd synology-docker ## Preparation before upgrade If you're using *compose* for your containers, I highly recommend that before you run the upgrade (or restore, if you're going back to the original version) you go through and stop each running container. ```console -$ cd /volume1/docker/{my_container} -$ docker-compose down +cd /volume1/docker/{my_container} +docker-compose down ``` Because this upgrade modifies the default logger for docker, stopping (removing) and re-starting each container is required, since the logging mechanism is persisted during a compose docker build / start. You don't HAVE to do this before the upgrade, however if you don't, you'll get errors related to the logger for your containers, and will have to stop and start each container / stack after the upgrade anyway. Stopping all the containers prior to the upgrade / restore will also make the upgrade a lot faster, since the service stop and restart normally has to do the work of stopping and starting all containers. -For a convenient way of enumerating all of the running *compose* projects, run the script `syno_docker_list_containers.sh` +For a convenient way of enumerating all of the running compose projects, run the script: -...if you see a container listed with `!---not_managed_by_compose---!` you'll need to make sure you know how to recreate this container after the upgrade. +```console +./syno_docker_list_containers.sh +``` +...if you see a container listed with !---not_managed_by_compose---! you'll need to make sure you know how to recreate this container after the upgrade. ## Usage *Synology-Docker* requires `sudo` rights. Use the following command to invoke *Synology-Docker* from the command line. ```console -$ sudo ./syno_docker_update.sh [OPTIONS] COMMAND +sudo ./syno_docker_update.sh [OPTIONS] COMMAND ``` + + ### Commands *Synology-Docker* supports the following commands. From 52337a7796e987f18c0ed3df40a837f8f43661d6 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Sun, 8 Sep 2024 14:39:52 -0500 Subject: [PATCH 16/22] Added Portainer and Nvidia Warnings --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6340e9e..0ac91ab 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,12 @@ | :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. | | --- | +| :warning: If you're using the Nvidia driver on your synology, you will need to re-start the Nvidia driver, or re-run `nvidia-ctk runtime configure` to re-add the nvidia runtime after each run of this script in order for the driver to get re-added to docker. | +| --- | + +| :exclamation: Portainer Users - Portainer currently has an [issue](https://github.com/portainer/portainer/issues/10462) where it persists the first-used logging driver alongside container definitions. You may have to completely recreate (or duplicate and edit) containers created in portainer to use the `local` log driver. It would be best to do that with all of your containers BEFORE running this update. Portainer has created some challenges for users migrating from one log driver to another. You may need to spend more time re-creating containers after this update than if you were using compose. +| --- | + [Synology][synology_url] 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][synology_docker]. 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.