Bug 45847 - docker.service failed to start after update - daemon.json: invalid
Summary: docker.service failed to start after update - daemon.json: invalid
Status: CLOSED NOTABUG
Alias: None
Product: Branch p10
Classification: Unclassified
Component: docker-registry (show other bugs)
Version: не указана
Hardware: x86_64 Linux
: P5 normal
Assignee: qa-team@altlinux.org
QA Contact: qa-p10@altlinux.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-13 10:50 MSK by Iakunin Andrei
Modified: 2023-04-17 10:29 MSK (History)
1 user (show)

See Also:


Attachments
Файл с ошибкой после обновления (421 bytes, application/json)
2023-04-13 10:50 MSK, Iakunin Andrei
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iakunin Andrei 2023-04-13 10:50:53 MSK
Created attachment 12954 [details]
Файл с ошибкой после обновления

После большого апдейта с изменениями за март 2023 у меня перестал запускаться docker.service.

Из journalctl стала видна ошибка:
unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '{' after top-level value

Насколько я понял, дело в том, что добавление строк:
{
  "insecure-registries": ["gitlab.basealt.space"]
}
в непустой /etc/docker/daemon.json делает его не валидным. И из-за этого не запускается docker. 

Возможно проблема в последнем обновлении:
Исходный пакет: docker-registry
Версия: 2.8.1-alt2
Собран:  31 марта 2023 г. 17:27 в задании #317510
Хотя я внимательно не смотрел.
Comment 1 Alexander Makeenkov 2023-04-17 10:29:45 MSK
(Ответ для Iakunin Andrei на комментарий #0)
> Создано вложение 12954 [details] [подробности]
> Файл с ошибкой после обновления

> Из journalctl стала видна ошибка:
> unable to configure the Docker daemon with file /etc/docker/daemon.json:
> invalid character '{' after top-level value
> 
> Насколько я понял, дело в том, что добавление строк:
> {
>   "insecure-registries": ["gitlab.basealt.space"]
> }
> в непустой /etc/docker/daemon.json делает его не валидным.

Тот json файл, который вы приложили, сам по себе является не валидным. Проверьте на любом валидаторе, например https://jsonlint.com

Строку insecure-registries нужно добавлять в уже имеющиеся {}, а не запихивать в отдельные:
# cat /etc/docker/daemon.json 
{
        "init-path": "/usr/bin/tini",
        "userland-proxy-path": "/usr/bin/docker-proxy",
        "default-runtime": "docker-runc",
        "live-restore": true,
        "log-driver": "journald",
        "runtimes": {
                "docker-runc": {
                        "path": "/usr/bin/runc"
                }
        },
        "default-ulimits": {
                "nofile": {
                "Name": "nofile",
                "Hard": 64000,
                "Soft": 64000
                }
        },
        "storage-driver": "overlay2",
        "insecure-registries": ["gitlab.basealt.space"]
}

Вот так всё работает, docker запускается без ошибок.