Record the problem that docker cannot be started once

What are the eight life cycle hook functions of Vue>>>

1. The installed docker CE could not be started with the following error:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2019-11-14 16:43:57 CST; 3min 56s ago
     Docs: https://docs.docker.com
  Process: 13443 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 13443 (code=exited, status=1/FAILURE)

Nov 14 16:43:55 -prometheus systemd[1]: Failed to start Docker Application Container Engine.
Nov 14 16:43:55 -prometheus systemd[1]: Unit docker.service entered failed state.
Nov 14 16:43:55 -prometheus systemd[1]: docker.service failed.
Nov 14 16:43:57 -prometheus systemd[1]: docker.service holdoff time over, scheduling restart.
Nov 14 16:43:57 -prometheus systemd[1]: Stopped Docker Application Container Engine.
Nov 14 16:43:57 -prometheus systemd[1]: start request repeated too quickly for docker.service
Nov 14 16:43:57 -prometheus systemd[1]: Failed to start Docker Application Container Engine.
Nov 14 16:43:57 -prometheus systemd[1]: Unit docker.service entered failed state.
Nov 14 16:43:57 -prometheus systemd[1]: docker.service failed.

$  journalctl -u docker 
-- Logs begin at Fri 2019-11-01 16:28:57 CST, end at Thu 2019-11-14 16:41:19 CST. --
Nov 01 17:00:01 -prometheus systemd[1]: Starting Docker Application Container Engine...
Nov 01 17:00:01 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:01.699229572+08:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Nov 01 17:00:01 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:01.700052946+08:00" level=info msg="libcontainerd: new containerd process, pid: 29518"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.715734090+08:00" level=warning msg="Docker could not enable SELinux on the host system"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.719846089+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.720276520+08:00" level=warning msg="Your kernel does not support cgroup memory limit"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.720295761+08:00" level=warning msg="Unable to find cpu cgroup in mounts"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.720306020+08:00" level=warning msg="Unable to find blkio cgroup in mounts"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.720315836+08:00" level=warning msg="Unable to find cpuset cgroup in mounts"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: time="2019-11-01T17:00:02.720481288+08:00" level=warning msg="mountpoint for pids not found"
Nov 01 17:00:02 -prometheus dockerd-current[29502]: Error starting daemon: Devices cgroup isn't mounted
Nov 01 17:00:02 -prometheus systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Nov 01 17:00:02 -prometheus systemd[1]: Failed to start Docker Application Container Engine.
Nov 01 17:00:02 -prometheus systemd[1]: Unit docker.service entered failed state.
Nov 01 17:00:02 -prometheus systemd[1]: docker.service failed.



Through the log, it is found that: error starting daemon: devices CGroup isn’t mounted, that is to say, CGroup is not mounted and can’t work

2. Solutions:

Just execute the script found in GitHub

#!/bin/sh
# Copyright 2011 Canonical, Inc
#           2014 Tianon Gravi
# Author: Serge Hallyn <[email protected]>
#         Tianon Gravi <[email protected]>
set -e

# for simplicity this script provides no flexibility

# if cgroup is mounted by fstab, don't run
# don't get too smart - bail on any uncommented entry with 'cgroup' in it
if grep -v '^#' /etc/fstab | grep -q cgroup; then
	echo 'cgroups mounted from fstab, not mounting /sys/fs/cgroup'
	exit 0
fi

# kernel provides cgroups?
if [ ! -e /proc/cgroups ]; then
	exit 0
fi

# if we don't even have the directory we need, something else must be wrong
if [ ! -d /sys/fs/cgroup ]; then
	exit 0
fi

# mount /sys/fs/cgroup if not already done
if ! mountpoint -q /sys/fs/cgroup; then
	mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi

cd /sys/fs/cgroup

# get/mount list of enabled cgroup controllers
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
	mkdir -p $sys
	if ! mountpoint -q $sys; then
		if ! mount -n -t cgroup -o $sys cgroup $sys; then
			rmdir $sys || true
		fi
	fi
done

# example /proc/cgroups:
#  #subsys_name	hierarchy	num_cgroups	enabled
#  cpuset	2	3	1
#  cpu	3	3	1
#  cpuacct	4	3	1
#  memory	5	3	0
#  devices	6	3	1
#  freezer	7	3	1
#  blkio	8	3	1

exit 0

Similar Posts: