systemctl status docker.service可看到如下的错误,docker无法启动
$ sudo systemctl status docker.service
docker.service: Main process exited, code=exited, status=1/FAILURE
docker.service: Failed with result 'exit-code'.
Failed to start Docker Application Container Engine.
docker.service: Scheduled restart job, restart counter is at 2.
Stopped Docker Application Container Engine.
如何debug
systemctl status所看到的日志是不全面的,需要用到journalctl,才可以看到完整日志
# journalctl -u docker
level=error msg="failed to mount overlay: no such device" storage-driver=overlay2
level=error msg="exec: \"fuse-overlayfs\": executable file not found in $PATH" storage-driver=fuse-overlayfs
level=error msg="AUFS was not found in /proc/filesystems" storage-driver=aufs
level=error msg="failed to mount overlay: no such device" storage-driver=overlay
failed to start daemon: error initializing graphdriver: devicemapper: Error running deviceCreate (CreatePool) dm_task_run failed
进一步分析
从日志可以看出没有overlay文件系统,在系统中做进一步确认
# cat /proc/filesystems
nodev sysfs
nodev tmpfs
nodev bdev
nodev proc
nodev cgroup
nodev cgroup2
nodev cpuset
nodev devtmpfs
nodev binfmt_misc
nodev configfs
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev ramfs
nodev hugetlbfs
nodev rpc_pipefs
nodev devpts
ext3
ext2
ext4
vfat
msdos
iso9660
nodev ecryptfs
nodev nfs
nodev nfs4
ntfs
解决问题
在做Linux文件系统的时候,遗漏了将内核的驱动模块放到文件系统的/lib/modules。将驱动模块拷贝到/lib/modules下
# ls /lib/modules
5.4.18-67-generic