markdumay/synology-docker

dockerd.json not updated

hirenshah opened this issue · 26 comments

Just did the full update process and found that my containers wouldn't start due to the "db" log driver not being found.

After a little digging, I noticed that the:
/var/packages/Docker/etc/dockerd.json

Still contains:

{
   "data-root" : "/var/packages/Docker/target/docker",
   "log-driver" : "db",
   "registry-mirrors" : [],
   "storage-driver" : "aufs"
}

The last time this file was changed was a month ago... guess that is when I installed a DSM update.

Thanks for catching this issue, it confirms my suspicion for issue #1. The log driver should be "json-file" instead of "db", as the db driver is specific to Synology's Docker package. It looks like "execute_update_log()" in the script does not work as expected, I'll look into it.

@markdumay

Line 394:

if [ ! -f "$SYNO_DOCKER_JSON" ] || grep "json-file" "$SYNO_DOCKER_JSON" -q ; then

Is the second half right? If it found a match, it would return 0, which is true. The return code you are looking for should be anything other than 0 right?

if [ ! -f "$SYNO_DOCKER_JSON" ] || [ ! grep "json-file" "$SYNO_DOCKER_JSON" -q] ; then

You're right, the second half is incorrect. I updated the function as follows:

# Configure log driver
execute_update_log() {
    print_status "Configuring log driver"
    if [ "$STAGE" == 'false' ] ; then
        LOG_DRIVER=$(grep "json-file" "$SYNO_DOCKER_JSON")
        if [ ! -f "$SYNO_DOCKER_JSON" ] || [ -z "$LOG_DRIVER" ] ; then
            mkdir -p "$SYNO_DOCKER_JSON_PATH"
            printf "$SYNO_DOCKER_JSON_CONFIG" > "$SYNO_DOCKER_JSON"
        fi
    else
        echo "Skipping configuration in STAGE mode"
    fi
}

A new branch 'logdriver' is available, care to try it?

Sure :)

I'm just restoring everything and then will attempt the update again :)

/Edit: Ignore Me :p

OK, I did a rerun on my NAS too, and it looks like $SYNO_DOCKER_JSON_CONFIG is not parsed correctly yet... I'll update the variable and will push it to the branch

So, I couldn't restore the backup... I got this:

root@DiskStation:/volume1/docker/synology-docker# sudo ./syno_docker_update.sh -b /volume1/docker/synology-docker/docker_backup_200611115000.tgz restore
Update Docker Engine and Docker Compose on Synology to target version

Current DSM version: 6.2.3
Current Docker version: 19.03.11
Current Docker Compose version: 1.26.0
Step 1 from 5: Stopping Docker service
pkgctl-Docker stoped.
Step 2 from 5: Extracting Docker backup (/volume1/docker/synology-docker//volume1/docker/synology-docker/docker_backup_200611115000.tgz)
bin/
bin/containerd
bin/auplink
bin/runc
bin/containerd-shim
bin/ctr
bin/dockerd
bin/docker-init
bin/docker
bin/docker-compose
bin/docker-proxy
dockerd.json
ERROR: Docker compose binary could not be extracted from archive

So I extracted it myself and restored the files manually.

Just noticed the "Step 2 from 5" path... guessing the two variables shouldn't be put together?

OK, I did a rerun on my NAS too, and it looks like $SYNO_DOCKER_JSON_CONFIG is not parsed correctly yet... I'll update the variable and will push it to the branch

Ahh yes, I just noticed that :)

At least it is a step in the right direction :)

ok, $SYNO_DOCKER_JSON_CONFIG is working on my NAS now. I had to manually delete /var/packages/Docker/etc/dockerd.json first, because the script detected the json-file driver, whilst the file itself had an incorrect syntax. :-/

/volume1/docker/synology-docker//volume1/docker/synology-docker/docker_backup_200611115000.tgz looks like another bug indeed, the -b flag should in theory override the working directory. I'll create a new issue.

Weird... the restore process worked perfectly this time round. I ran the same command as the one I mentioned here:
#3 (comment)

That's weird indeed. I checked the code and noticed an issue here:

execute_extract_backup() {
    print_status "Extracting Docker backup ($WORKING_DIR/$DOCKER_BACKUP_FILENAME)"
    BASEPATH=$(dirname "$DOCKER_BACKUP_FILENAME")
    FILENAME=$(basename "$DOCKER_BACKUP_FILENAME") 
    cd "$BASEPATH"
    tar -zxvf "$FILENAME"

    [ ... ]
}

Print_status incorrectly prepends $WORKING_DIR/ as this is already present in $DOCKER_BACKUP_FILENAME. However, that should not have impact on the tar command as it uses $FILENAME instead.

Hey guys,
i still get the error on my influxdb docker file when i try to start it after the update:
Create container InfluxDB failed: {"message":"logger: no log driver named 'db' is registered"}.

Hi @markdumay ,

  • Dockerfile command:
    $ docker run -p 8086:8086 \ -v $PWD:/var/lib/influxdb \ influxdb
  • Syno_docker_update command:
    sudo ./syno_docker_update.sh update (Console output was uneventful)
  • Docker is in /var/packages/Docker

There were a lot of messages. But no fail messages. And i didn't save them, sorry :/

Hey there
I'm having the same issue.
Output :

Update Docker Engine and Docker Compose on Synology to target version

Current DSM version: 6.2.3
Current Docker version: 18.09.8
Current Docker Compose version: 1.24.0
Target Docker version: 19.03.13
Target Docker Compose version: 1.27.4

WARNING! This will replace:
  - Docker Engine
  - Docker Compose
  - Docker daemon log driver

Are you sure you want to continue? [y/N] y
Step 1 from 9: Downloading target Docker binary (https://download.docker.com/linux/static/stable/x86_64/docker-19.03.13.tgz)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 59.3M  100 59.3M    0     0  1014k      0  0:00:59  0:00:59 --:--:-- 1066k
Step 2 from 9: Downloading target Docker Compose binary (https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   651  100   651    0     0   2883      0 --:--:-- --:--:-- --:--:--  2906
100 11.6M  100 11.6M    0     0   916k      0  0:00:13  0:00:13 --:--:-- 1019k
Step 3 from 9: Stopping Docker service
pkgctl-Docker stoped.
Step 4 from 9: Backing up current Docker binaries (/volume1/homes/Rui/synology-docker/docker_backup_20201114_205835.tgz)
bin/
bin/containerd-shim
bin/ctr
bin/runc
bin/docker-compose
bin/docker-init
bin/docker-proxy
bin/auplink
bin/containerd
bin/dockerd
bin/docker
dockerd.json
Step 5 from 9: Extracting target Docker binary (/tmp/docker_update/docker-19.03.13.tgz)
docker/
docker/ctr
docker/runc
docker/containerd-shim
docker/docker-init
docker/docker-proxy
docker/docker
docker/dockerd
docker/containerd
Step 6 from 9: Installing binaries
Step 7 from 9: Configuring log driver
Step 8 from 9: Starting Docker service

pkgctl-Docker started.
Step 9 from 9: Cleaning the temp folder
Done.

then I try to run my portainer container with:
docker start portainer
and I get:
Error response from daemon: failed to initialize logging driver: failed to get logging factory: logger: no log driver named 'db' is registered: error looking up logging plugin db: plugin "db" not found Error: failed to start containers: portainer

Anything else I should look for ?

Rui

and maybe this helps as well:

Rui@DiskStation:~/synology-docker$ more /var/packages/Docker/etc/dockerd.json 
{
    "data-root" : "/var/packages/Docker/target/docker",
    "log-driver" : "json-file",
    "registry-mirrors" : [],
    "group": "administrators"
}`

As a note, after clearing my issue in #48, I also ran into this problem. Here's my post-update dockerd.json.

{
    "data-root" : "/var/packages/Docker/target/docker",
    "log-driver" : "json-file",
    "registry-mirrors" : [],
    "group": "administrators"
}

Hello,

same problem as @rui-nar, i have ths error message:

Create container eclipse-mosquitto1 failed: {"message":"error looking up logging plugin db: plugin "db" not found"}.

i have this dockerd.json file:
{ "registry-mirrors": [], "data-root": "/var/packages/Docker/target/docker",\ "log-driver": "json-file",\ "group" : "administrator"\ }

someone have solve this problem? The hard drive on Docker is working is an ext4

  1. What's wrong with db driver? What are the properties of it?
  2. Why do we then prefer json-file and not local?

It seems db is a proprietary driver from Synology. It is not available with a default Docker installation. I have not tried local instead of json-file myself - care to try it and share your experience?

I'll probably be trying it now. Allegedly it's the same thing (with log rotation support and stuff) as json-file but with less overhead than a json encoding.
The reason I am thinking of deviating from db is it seems to completely give up after a certain amount of spam. A running docker logs -f just stops yielding lines, the UI keeps only displaying logs up until that moment, and new docker --log-level=debug logs <container> just sit there, regardless of any --since or -f, not yielding any preexisting or new lines.
(My spammy container is eclipse/mosquitto with log_type all, but I do need those logs. Maybe I'll move its logs to tmpfs idk. Ideally, I need to process those logs and not store them.)

It seems that local works fine.
"No logs available." in the UI, but copes with the spam.
Fun side effect: in docker logs -t the db driver gave timestamp prefixes like
2021-11-28T20:32:08.859717886Z (RFC3339Nano Z, two spaces) while local gives
2021-11-29T16:22:01.465997093+03:00 (RFC3339Nano Local, one space)