linux – 无法在Ubuntu 16.04.2 LTS上启动docker(初始化graphdriver时出错)
作者:互联网
使用systemctl启动docker时遇到以下错误:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
以下是我的cat表单启动服务的输出:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-07-14 18:23:13 IST; 2min 4s ago
Docs: https://docs.docker.com
Process: 6325 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 6325 (code=exited, status=1/FAILURE)
Jul 14 18:23:12 iconlap02 systemd[1]: Starting Docker Application Container Engine...
Jul 14 18:23:12 iconlap02 dockerd[6325]: time="2017-07-14T18:23:12.415162784+05:30" level=info msg="libcontainerd: new containerd process, pid: 6333"
Jul 14 18:23:13 iconlap02 dockerd[6325]: Error starting daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: aufs, overlay; Please cleanup or explicitly choose storage driver (-s <DRIVER>)
Jul 14 18:23:13 iconlap02 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 18:23:13 iconlap02 systemd[1]: Failed to start Docker Application Container Engine.
Jul 14 18:23:13 iconlap02 systemd[1]: docker.service: Unit entered failed state.
Jul 14 18:23:13 iconlap02 systemd[1]: docker.service: Failed with result 'exit-code'.
解决方法:
我做了一些研究,我找到了答案.我能够通过使用overlay2作为存储驱动程序来解决问题.我按照以下链接:https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/
我采取了followins步骤来解决问题:
>停止Docker.
sudo systemctl stop docker
>将/ var / lib / docker的内容复制到临时位置.
cp -au /var/lib/docker /var/lib/docker.bk
>编辑/etc/docker/daemon.json.如果它还不存在:创建它.假设文件为空,请添加以下内容:
{
"storage-driver": "overlay2"
}
>启动Docker.
sudo systemctl start docker
>验证守护程序是否正在使用overlay / overlay2存储驱动程序.
sudo docker info
在此之后,我能够在我的“16.04.2 LTS(Xenial Xerus)”上运行docker container
sudo docker run -dit ubuntu
Docker CE
对于Docker CE,仅测试一些配置.您的操作系统内核可能不支持每个存储驱动程序.通常,以下配置适用于最新版本的Linux发行版:
Linux发行版支持的存储驱动
Ubuntu aufs上的Docker CE,devicemapper,overlay2(Ubuntu 14.04.4或更高版本,16.04或更高版本),overlay,zfs
https://github.com/moby/moby/issues/24023
标签:linux,docker,ubuntu-16-04 来源: https://codeday.me/bug/20190823/1699705.html