docker start failed after adding daemon.json file - docker

I'm trying to install Kubernetes on CentOS 7.7, therefore, I have to install docker first.
I followed Kubernetes Documentation to install docker-ce and modify daemon.json file.
$ yum install yum-utils device-mapper-persistent-data lvm2
$ yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ yum update && yum install \
containerd.io-1.2.10 \
docker-ce-19.03.4 \
docker-ce-cli-19.03.4
$ mkdir /etc/docker
$ cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
$ mkdir -p /etc/systemd/system/docker.service.d
$ systemctl daemon-reload
$ systemctl start docker
When started docker service, it said:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
$ systemctl status -l 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 Tue 2020-01-07 14:44:11 UTC; 7min ago
Docs: https://docs.docker.com
Process: 9879 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 9879 (code=exited, status=1/FAILURE)
Jan 07 14:44:09 love61y2222c.mylabserver.com systemd[1]: Failed to start Docker Application Container Engine.
Jan 07 14:44:09 love61y2222c.mylabserver.com systemd[1]: Unit docker.service entered failed state.
Jan 07 14:44:09 love61y2222c.mylabserver.com systemd[1]: docker.service failed.
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: docker.service holdoff time over, scheduling restart.
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: Stopped Docker Application Container Engine.
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: start request repeated too quickly for docker.service
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: Failed to start Docker Application Container Engine.
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: Unit docker.service entered failed state.
Jan 07 14:44:11 love61y2222c.mylabserver.com systemd[1]: docker.service failed.
$ journalctl -xe
.
.
-- Unit docker.service has begun starting up.
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.722780008Z" level=info msg="Starting up"
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.728447514Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.728479813Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.728510943Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.728526075Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.732325726Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.733844225Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.733880664Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.733898044Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: time="2020-01-07T15:28:25.743421350Z" level=warning msg="Using pre-4.0.0 kernel for overlay2, mount failures may require
Jan 07 15:28:25 love61y2223c.mylabserver.com dockerd[29628]: failed to start daemon: error initializing graphdriver: overlay2: the backing xfs filesystem is formatted without d_type
Jan 07 15:28:25 love61y2223c.mylabserver.com systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 07 15:28:25 love61y2223c.mylabserver.com systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Jan 07 15:28:25 love61y2223c.mylabserver.com systemd[1]: Unit docker.service entered failed state.
Jan 07 15:28:25 love61y2223c.mylabserver.com systemd[1]: docker.service failed.
Could anyone tell me why docker service start failed after modifying daemon.json file? And how to specify cgroupdriver, default log-driver and default storage-driver in the right way?
Any suggestion will be greatly appreciated.
Thanks.

This error is pointing to an issue forcing docker to use overlay2 without the proper backing filesystem:
failed to start daemon: error initializing graphdriver: overlay2: the backing xfs filesystem is formatted without d_type
See docker's table for details on backing filesystem requirements for the different storage drivers: https://docs.docker.com/storage/storagedriver/#supported-backing-filesystems
The fix is to remove the storage driver settings, or fix the backing filesystem with the needed options to support overlay2:
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
}
}
For details on changing the xfs options, that appears to require rebuilding the filesystem. See this answer for more details on the needed steps.

Related

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.

Docker not getting start on slave node in kubernetes

execute below command on slave node in kubernetes cluster.
for SERVICES in docker; do systemctl restart $SERVICES; systemctl enable $SERVICES; systemctl status $SERVICES; done
got below error
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/docker.service.d
└─flannel.conf
Active: failed (Result: exit-code) since Wed 2018-04-11 11:20:10 GMT; 67ms ago
Docs: http://docs.docker.com
Main PID: 2315 (code=exited, status=1/FAILURE)
Apr 11 11:20:10 LX01511L docker[2315]: time="2018-04-11T11:20:10Z" level=error msg="WARNING: No --storage-opt dm.thinpooldev specified, using loopback; thi...ction use"
Apr 11 11:20:10 LX01511L docker[2315]: time="2018-04-11T11:20:10Z" level=warning msg="Docker could not enable SELinux on the host system"
Apr 11 11:20:10 LX01511L docker[2315]: time="2018-04-11T11:20:10Z" level=info msg="+job init_networkdriver()"
Apr 11 11:20:10 LX01511L docker[2315]: Bridge ip (172.17.42.1) does not match existing bridge configuration 172.30.81.1
Apr 11 11:20:10 LX01511L docker[2315]: time="2018-04-11T11:20:10Z" level=info msg="-job init_networkdriver() = ERR (1)"
Apr 11 11:20:10 LX01511L docker[2315]: time="2018-04-11T11:20:10Z" level=fatal msg="Shutting down daemon due to errors: Bridge ip (172.17.42.1) does not ma...2.30.81.1"
Apr 11 11:20:10 LX01511L systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 11 11:20:10 LX01511L systemd[1]: Failed to start Docker Application Container Engine.
Apr 11 11:20:10 LX01511L systemd[1]: Unit docker.service entered failed state.
Apr 11 11:20:10 LX01511L systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
msg="Shutting down daemon due to errors: Bridge ip (172.17.42.1) does not ma...2.30.81.1"

How do I clear a thinpool device for docker

I am running docker on a Redhat system with devicemapper and thinpool device just as recommended for production systems. Now when I want to reinstall docker I need two steps:
1) remove docker directory (in my case /area51/docker)
2) clear thinpool device
The docker documentation states that when using devicemapper with dm.metadev and dm.datadev options, the easiest way of cleaning devicemapper would be:
If setting up a new metadata pool it is required to be valid.
This can be achieved by zeroing the first 4k to indicate empty metadata, like this:
$ dd if=/dev/zero of=$metadata_dev bs=4096 count=1
Unfortunately, according to the documentation, the dm.metadatadev is deprecated, it says to use dm.thinpooldev instead.
My thinpool has been created along the lines of this docker instruction
So, my setup now looks like this:
cat /etc/docker/daemon.json
{
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/thinpool_VG_38401-thinpool",
"dm.basesize=18G"
]
}
Under the devicemapper directory i see the following thinpool devices
ls -l /dev/mapper/thinpool_VG_38401-thinpool*
lrwxrwxrwx 1 root root 7 Dec 6 08:31 /dev/mapper/thinpool_VG_38401-thinpool -> ../dm-8
lrwxrwxrwx 1 root root 7 Dec 6 08:31 /dev/mapper/thinpool_VG_38401-thinpool_tdata -> ../dm-7
lrwxrwxrwx 1 root root 7 Dec 6 08:31 /dev/mapper/thinpool_VG_38401-thinpool_tmeta -> ../dm-6
So, after running docker successfully I tried to reinstall as described above and clear the thinpool by writing 4K zeroes into the tmeta device and restart docker:
dd if=/dev/zero of=/dev/mapper/thinpool_VG_38401-thinpool_tmeta bs=4096 count=1
systemctl start docker
And endet up with
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-12-06 10:28:46 UTC; 10s ago
Docs: https://docs.docker.com
Process: 1566 ExecStart=/usr/bin/dockerd -G uwsgi --data-root=/area51/docker -H unix:///var/run/docker.sock (code=exited, status=1/FAILURE)
Main PID: 1566 (code=exited, status=1/FAILURE)
Memory: 236.0K
CGroup: /system.slice/docker.service
Dec 06 10:28:45 yoda3 systemd[1]: Starting Docker Application Container Engine...
Dec 06 10:28:45 yoda3 dockerd[1566]: time="2017-12-06T10:28:45.816049000Z" level=info msg="libcontainerd: new containerd process, pid: 1577"
Dec 06 10:28:46 yoda3 dockerd[1566]: time="2017-12-06T10:28:46.816966000Z" level=warning msg="failed to rename /area51/docker/tmp for background deletion: renam...chronously"
Dec 06 10:28:46 yoda3 dockerd[1566]: Error starting daemon: error initializing graphdriver: devmapper: Unable to take ownership of thin-pool (thinpool_VG_38401-...data blocks
Dec 06 10:28:46 yoda3 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 06 10:28:46 yoda3 systemd[1]: Failed to start Docker Application Container Engine.
Dec 06 10:28:46 yoda3 systemd[1]: Unit docker.service entered failed state.
Dec 06 10:28:46 yoda3 systemd[1]: docker.service failed.
I assumed I could get around the 'unable to take ownership of thin-pool' by doing a reboot. But after reboot and trying to start docker again I got the following error:
systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-12-06 10:30:37 UTC; 2min 29s ago
Docs: https://docs.docker.com
Process: 3180 ExecStart=/usr/bin/dockerd -G uwsgi --data-root=/area51/docker -H unix:///var/run/docker.sock (code=exited, status=1/FAILURE)
Main PID: 3180 (code=exited, status=1/FAILURE)
Memory: 37.9M
CGroup: /system.slice/docker.service
Dec 06 10:30:36 yoda3 systemd[1]: Starting Docker Application Container Engine...
Dec 06 10:30:36 yoda3 dockerd[3180]: time="2017-12-06T10:30:36.893777000Z" level=warning msg="libcontainerd: makeUpgradeProof could not open /var/run/docker/lib...containerd"
Dec 06 10:30:36 yoda3 dockerd[3180]: time="2017-12-06T10:30:36.901958000Z" level=info msg="libcontainerd: new containerd process, pid: 3224"
Dec 06 10:30:37 yoda3 dockerd[3180]: Error starting daemon: error initializing graphdriver: devicemapper: Non existing device thinpool_VG_38401-thinpool
Dec 06 10:30:37 yoda3 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 06 10:30:37 yoda3 systemd[1]: Failed to start Docker Application Container Engine.
Dec 06 10:30:37 yoda3 systemd[1]: Unit docker.service entered failed state.
Dec 06 10:30:37 yoda3 systemd[1]: docker.service failed.
So, obviously writing zeroes into the thinpool_meta device is not the right thing to do, it seems to destroy my thinpool device.
Anyone here that can tell me the right steps to clear the thin-pool device? Preferably the solution should not require a reboot.

Error while trying to start docker daemon service using systemctl (CoreOS)

Following is the error I am getting while trying to start the docker daemon service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─50-docker-service.conf
Active: failed (Result: exit-code) since Tue 2017-08-22 02:09:40 UTC; 15min ago
Docs: http://docs.docker.com
Main PID: 3571 (code=exited, status=1/FAILURE)
CPU: 292ms
Aug 22 02:09:40 systemd[1]: docker.service: Unit entered failed state.
Aug 22 02:09:40 systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 22 02:09:40 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Aug 22 02:09:40 systemd[1]: Stopped Docker Application Container Engine.
Aug 22 02:09:40 systemd[1]: docker.service: Start request repeated too quickly.
Aug 22 02:09:40 systemd[1]: Failed to start Docker Application Container Engine.
Aug 22 02:09:40 systemd[1]: docker.service: Unit entered failed state.
Aug 22 02:09:40 systemd[1]: docker.service: Failed with result 'exit-code'.
Below is the config files I have
50-docker-service.conf
[Service]
Environment="DOCKER_OPTS=--bip=A.B.C.D"
what could be the cause?
$ls -ltr /etc/systemd/system/docker.service.d
total 16
-rw-r--r--. 1 root root 125 Aug 22 02:09 50-docker-service.conf
journalctl logs
Jul 14 13:55:52 systemd[1]: Starting Docker Application Container Engine...
Jul 14 13:55:52 dockerd[1274]: time="2017-07-14T13:55:52.925276313Z" level=info msg="[graphdriver] using prior storage driver \"overlay\""
Jul 14 13:55:53 dockerd[1274]: time="2017-07-14T13:55:53.378204522Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jul 14 13:55:53 dockerd[1274]: time="2017-07-14T13:55:53.379367854Z" level=info msg="Loading containers: start."
Jul 14 13:55:53 dockerd[1274]: ..time="2017-07-14T13:55:53.507972850Z" level=info msg="Firewalld running: false"
Jul 14 13:55:54 dockerd[1274]: time="2017-07-14T13:55:54.013379242Z" level=info msg="Loading containers: done."
Jul 14 13:55:54 dockerd[1274]: time="2017-07-14T13:55:54.021206395Z" level=info msg="Daemon has completed initialization"
Jul 14 13:55:54 dockerd[1274]: time="2017-07-14T13:55:54.021283711Z" level=info msg="Docker daemon" commit=a82d35e graphdriver=overlay version=1.12.6
Jul 14 13:55:54 systemd[1]: Started Docker Application Container Engine.
Jul 14 13:55:54 dockerd[1274]: time="2017-07-14T13:55:54.039479153Z" level=info msg="API listen on /var/run/docker.sock"
Jul 14 13:56:03 dockerd[1274]: time="2017-07-14T13:56:03.565234227Z" level=error msg="Handler for POST /v1.24/containers/7019b26d0cb3/start returned error: Container already started"
Jul 14 13:56:09 dockerd[1274]: time="2017-07-14T13:56:09.660967581Z" level=error msg="Handler for POST /v1.24/containers/7019b26d0cb3/start returned error: Container already started"
Jul 14 13:56:14 dockerd[1274]: time="2017-07-14T13:56:14.741806551Z" level=error msg="Handler for POST /v1.24/containers/d9a3cb2b66e0/start returned error: Container already started"
Jul 14 21:05:16 dockerd[1274]: time="2017-07-14T21:05:16.992138499Z" level=info msg="Container 7019b26d0cb31412f40f8ab7f971f26896debcce09a58c39679dbaf62f6caa0b failed to exit within 0 s
Jul 14 21:07:20 dockerd[1274]: time="2017-07-14T21:07:20.897682536Z" level=info msg="Container d9a3cb2b66e0395086decd444f7ef52775f76f64b8d4dc291ee66cca48e53535 failed to exit within 2 s
Jul 14 21:08:08 systemd[1]: Stopping Docker Application Container Engine...
Jul 14 21:08:08 dockerd[1274]: time="2017-07-14T21:08:08.243279424Z" level=info msg="Processing signal 'terminated'"
Jul 14 21:08:18 dockerd[1274]: time="2017-07-14T21:08:18.244896088Z" level=info msg="Container 9966c97ca301ef593a68ab8e50730552dbe945c42e6b530d4c6339d3ffa8f544 failed to exit within 10
Jul 14 21:08:18 dockerd[1274]: time="2017-07-14T21:08:18.244909995Z" level=info msg="Container d94a3d0c45471753da85fce062e3c56c79c14ad40b6870281515333b98d0807e failed to exit within 10
Jul 14 21:08:18 dockerd[1274]: time="2017-07-14T21:08:18.244936931Z" level=info msg="Container b49d40479583c121ae7abe14489c7121a25a56da00f3d25961f981c918d3257e failed to exit within 10
Jul 14 21:08:18 systemd[1]: Stopped Docker Application Container Engine.
Docker bridge ip is not configured properly.
Environment="DOCKER_OPTS=--bip=A.B.C.D
Instead configured bip with a fully qualified CIDR
Environment="DOCKER_OPTS=--bip=A.B.C.D/size
that solved my problem
Check ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
is not modified in /lib/systemd/system/docker.service

Can't start working with docker

I use ubuntu 16.04.
Suddenly (sorry), I can't run docker.
When I run command in the terminal I only have this (expected output was info about client and daemon versions):
$ sudo docker --version
Docker version 1.12.3, build 6b644ec
When I run commands line this
$ sudo docker ps
I have nothing for long time:
How can I overcome this problem?
$ sudo service docker status
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Ср 2017-01-04 18:14:48 MSK; 12s ago
Docs: https://docs.docker.com
Process: 9534 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 9534 (code=exited, status=1/FAILURE)
янв 04 18:14:47 kenenbek dockerd[9534]: time="2017-01-04T18:14:47.446210980+03:00" level=warning msg="Your kernel does not support swap memory limit."
янв 04 18:14:47 kenenbek dockerd[9534]: time="2017-01-04T18:14:47.447160673+03:00" level=info msg="Loading containers: start."
янв 04 18:14:47 kenenbek dockerd[9534]: .................time="2017-01-04T18:14:47.469385119+03:00" level=info msg="Firewalld running: false"
янв 04 18:14:47 kenenbek dockerd[9534]: time="2017-01-04T18:14:47.881263583+03:00" level=info msg="Default bridge (docker0) is assigned with an IP addr
янв 04 18:14:48 kenenbek dockerd[9534]: time="2017-01-04T18:14:48.736641043+03:00" level=info msg="Loading containers: done."
янв 04 18:14:48 kenenbek dockerd[9534]: time="2017-01-04T18:14:48.790061315+03:00" level=fatal msg="Error creating cluster component: error while loadi
янв 04 18:14:48 kenenbek systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
янв 04 18:14:48 kenenbek systemd[1]: Failed to start Docker Application Container Engine.
янв 04 18:14:48 kenenbek systemd[1]: docker.service: Unit entered failed state.
янв 04 18:14:48 kenenbek systemd[1]: docker.service: Failed with result 'exit-code'.
When I get such output when I run:
$ sudo service docker restart
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
This looks like a docker swarm certificate related issue as reported here
A solution to this problem will be released in version 1.13. For now you can try forcing recreating the swarm as explained here.

Resources