Why did docker.service fails after editing daemon.json? - docker

I got
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-12-20 10:28:45 CET; 29min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Process: 185839 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 185839 (code=exited, status=1/FAILURE)
Dec 20 10:28:45 miki-ancic systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Dec 20 10:28:45 miki-ancic systemd[1]: Stopped Docker Application Container Engine.
Dec 20 10:28:45 miki-ancic systemd[1]: docker.service: Start request repeated too quickly.
Dec 20 10:28:45 miki-ancic systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 20 10:28:45 miki-ancic systemd[1]: Failed to start Docker Application Container Engine.
I edited /etc/docker/daemon.json
{
"icc" : false,
"userns-remap": "default",
"log-driver": "syslog",
"live-restore": true,
"userland-proxy": false,
"no-new-privileges": true
}
I tried
sudo dockerd --debug
DEBU[2022-12-20T11:04:03.988039125+01:00] Registering POST, /networks/{id:.*}/connect
DEBU[2022-12-20T11:04:03.988200113+01:00] Registering POST, /networks/{id:.*}/disconnect
DEBU[2022-12-20T11:04:03.988360830+01:00] Registering POST, /networks/prune
DEBU[2022-12-20T11:04:03.988510707+01:00] Registering DELETE, /networks/{id:.*}
INFO[2022-12-20T11:04:03.989134350+01:00] API listen on /var/run/docker.sock
How do I debug this issue?
What does Start request repeated too quickly really mean?

Related

Failed to start Docker Application Container Engine on Ubuntu

I am running Docker on a Ubuntu server:
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
Docker was running without problems for a year or so but suddenly it is not available anymore:
root#srv-lab-t-427:/home/schm# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2023-02-05 06:43:29 UTC; 2min 43s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Process: 1478999 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/>
Main PID: 1478999 (code=exited, status=1/FAILURE)
Feb 05 06:43:29 srv-lab-t-427 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Feb 05 06:43:29 srv-lab-t-427 systemd[1]: Stopped Docker Application Container Engine.
Feb 05 06:43:29 srv-lab-t-427 systemd[1]: docker.service: Start request repeated too quickly.
Feb 05 06:43:29 srv-lab-t-427 systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 05 06:43:29 srv-lab-t-427 systemd[1]: Failed to start Docker Application Container Engine.
Any idea how to fix this?

How can i use docker tool on my containerd node?

I had changed my nodes' runtime into containerd. But now i would like to use docker tool instead. I try refresh the dockerd service config as follow:
[Service]
......
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1 -H fd:// --containerd=/var/run/containerd/containerd.sock --cri-containerd --debug
......
And it doesn t work unexpected.
$ systemctl status docker.service
● docker.service
Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─http-proxy.conf
Active: failed (Result: start-limit) since Mon 2022-11-07 16:10:51 CST; 10s ago
Docs: https://docs.docker.com
Process: 4872 ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1 -H fd:// --containerd=/var/run/containerd/containerd.sock --cri-containerd --debug (code=exited, status=1/FAILURE)
Main PID: 4872 (code=exited, status=1/FAILURE)
Nov 07 16:10:51 master systemd[1]: Failed to start docker.service.
Nov 07 16:10:51 master systemd[1]: Unit docker.service entered failed state.
Nov 07 16:10:51 master systemd[1]: docker.service failed.
Nov 07 16:10:51 master systemd[1]: docker.service holdoff time over, scheduling restart.
Nov 07 16:10:51 master systemd[1]: Stopped docker.service.
Nov 07 16:10:51 master systemd[1]: start request repeated too quickly for docker.service
Nov 07 16:10:51 master systemd[1]: Failed to start docker.service.
Nov 07 16:10:51 master systemd[1]: Unit docker.service entered failed state.
Nov 07 16:10:51 master systemd[1]: docker.service failed.
I suppose it is easy before. Please tell me the right config.
I expect it will work easily.

Cannot connect to the Docker daemon at unix:///var/run/docker.sock on Ubuntu 16.04

Accidentally, my docker goes wrong, and cannot be started.
docker psgives the following error
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
And systemctl status docker.service gives the following outputs:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─override.conf
Active: failed (Result: start-limit-hit) since Tue 2018-11-20 18:27:11 PST; 11s ago
Docs: https://docs.docker.com
Process: 16519 ExecStart=/usr/bin/dockerd --host=fd:// --add-runtime=nvidia=/usr/bin/nvidia-container-runtime (code=exited, status=1/FAILURE)
Main PID: 16519 (code=exited, status=1/FAILURE)
Nov 20 18:27:09 loccalhost systemd[1]: Failed to start Docker Application Container Engine.
Nov 20 18:27:09 loccalhost systemd[1]: docker.service: Unit entered failed state.
Nov 20 18:27:09 loccalhost systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Nov 20 18:27:11 loccalhost systemd[1]: Stopped Docker Application Container Engine.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Start request repeated too quickly.
Nov 20 18:27:11 loccalhost systemd[1]: Failed to start Docker Application Container Engine.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Unit entered failed state.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Failed with result 'start-limit-hit'.
A more recent answer in the same thread mentioned by skyuua suggests the following (it changes the -H fd:// to -H unix://)
sudo systemctl edit docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://127.0.0.1:2375
followed by
sudo systemctl daemon-reload
sudo systemctl restart docker.service
On my Ubuntu 16.04 with docker 18.0.3 this rewrites the file /etc/systemd/system/docker.service.d/override.conf which allowed docker to start correctly.
We ran sudo apt-get update, our docker version got updated too, it changed from 18.09.1 to 18.09.3, and docker went haywire. After digging online, I fould following solution that solved issue for us.
sudo systemctl edit docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd-ce -H unix://var/run/docker.sock -H tcp://0.0.0.0:2375
then restart service
sudo systemctl restart docker.service

docker: docker start fails after creating daemon.json

I am trying to setup awslogs for docker.
The docs say to add this to daemon.json:
{
"log-driver": "awslogs",
"log-opts": {
"awslogs-region": "eu-central-1"
}
}
When I create on Ubuntu /etc/docker/daemon.json with the content above docker wont start again.
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fr 2018-07-20 10:59:53 CEST; 11s ago
Docs: https://docs.docker.com
Process: 647 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 647 (code=exited, status=1/FAILURE)
Jul 20 10:59:53 dev01-ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: docker.service: Unit entered failed state.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: Stopped Docker Application Container Engine.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: docker.service: Start request repeated too quickly.
Jul 20 10:59:53 dev01-ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Can anybody explain this behaviour?
Not ever use it.
But from this: https://docs.docker.com/config/containers/logging/plugins/, it seems we need to install plugin for any new log driver, check it with docker plugin ls
Maybe it just available in amazon cloud environment, not available in local pc, just in case you did not notice that.

start docker error when add --insecure-registry

i want create private registry and follow this answer Setting up a remote private Docker registry
docker run -p 5000:5000 registry
and other servre modify /usr/lib/systemd/system/docker.service file to disable https
ExecStart=/usr/bin/dockerd --insecure-registry 172.24.54.41:5000
i can curl 172.24.54.41:5000
sudo service docker stop
sudo systemctl daemon-reload
sudo systemctl start docker
the error log in systemctl status docker.service
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2017-12-11 16:52:23 CST; 6min ago
Docs: https://docs.docker.com
Process: 13300 ExecStart=/usr/bin/dockerd --insecure-registry 172.24.54.41:5000 (code=exited, status=1/FAILURE)
Main PID: 13300 (code=exited, status=1/FAILURE)
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: Failed to start Docker Application Container Engine.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: Unit docker.service entered failed state.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: docker.service failed.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: docker.service holdoff time over, scheduling restart.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: start request repeated too quickly for docker.service
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: Failed to start Docker Application Container Engine.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: Unit docker.service entered failed state.
Dec 11 16:52:23 iZhp39y3a2bx21oz0waijyZ systemd[1]: docker.service failed.
how to solve it?
It seems that the issue does not lie with your running of a registry but with your configuration of the docker service.
Could you link the content of your usr/lib/systemd/system/docker.service file?

Resources