升级内核后无法启动docker

使用了manjaro自带工具更新了linux内核版本到4.14.3之后,docker启动失败

原因

在ststemd中,sudo systemctl status docker.service 不能看到全部的出错信息,只能手动启动docker: sudo dockerd

手动启动之后可以看到错误信息为:

1
[graphdriver] prior storage driver aufs failed: driver not supported

具体原因如下 issue地址

1
2
3
4
5
6
7
The aufs storage driver depends on the linux-image-extra packages being installed; those packages are tied to the kernel version, so should be upgraded as well after upgrading the kernel.

IIRC, Manjaro linux is based on Arch, which is known to be distributing "bleeding edge" packages, and because of that is known to break things regularly. For this reason, we don't have official packages for that distribution.

To resolve this; check if aufs is available for that kernel version, or select a different storage driver. When selecting a different storage driver, you may want to do a "factory reset" and remove your /var/lib/docker directory; doing so will remove all your images and containers.

For kernel 4 and up, the overlay2 (or overlay) diver may be a good choice, but this depends on your use case (see https://docs.docker.com/engine/userguide/storagedriver/selectadriver/)

解决方法

最简单粗暴的方法:sudo mv /var/lib/docker /var/lib/docker.old,然后重启

这个方法有个弊端,因为docker的所有文件都是在这个文件夹里面的,所以所有的container和image都会没了

重新启动之后,查看 docker info 会发现,storage driver 变成了 overlay2

或者可以尝试 这个方法,不过我已经靠上面issue中提到的的方法解决了问题