无法在Ubuntu 16.04.2 LTS上启动Docker(初始化graphdriver出错) [英] Not able to start docker on Ubuntu 16.04.2 LTS (error initializing graphdriver)

查看:271
本文介绍了无法在Ubuntu 16.04.2 LTS上启动Docker(初始化graphdriver出错)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用systemctl启动docker时遇到以下错误:

Facing the below error while starting docker with systemctl:

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

如果我为表单启动服务添加以下内容,则输出为:

Below is the output if I cat form start service:

● 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/引擎/用户指南/存储驱动程序/overlayfs-驱动程序/

I did some research and I found the answer. I was able to fix the issue by using the overlay2 as storage driver. I followed the below link for that: https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/

我已按照以下步骤解决了该问题:

I took the followins steps to fix the issue:

  1. 停止Docker.

  1. Stop Docker.

sudo systemctl stop docker

  • /var/lib/docker的内容复制到一个临时位置.

  • Copy the contents of /var/lib/docker to a temporary location.

    cp -au /var/lib/docker /var/lib/docker.bk
    

  • 编辑/etc/docker/daemon.json.如果尚不存在:创建它.假设文件为空,请添加以下内容:

  • Edit /etc/docker/daemon.json. If it doesn't exist yet: create it. Assuming that the file was empty, add the following contents:

    {
      "storage-driver": "overlay2"
    }
    

  • 启动Docker.

  • Start Docker.

    sudo systemctl start docker
    

  • 验证守护程序是否正在使用overlay/overlay2存储驱动程序.

  • Verify that the daemon is using the overlay/overlay2 storage driver.

    sudo docker info
    

  • 此后,我可以在"16.04.2 LTS(Xenial Xerus)"上运行docker容器

    After this I was able to run docker container on my "16.04.2 LTS (Xenial Xerus)"

    sudo docker run -dit ubuntu
    

    Docker CE

    对于Docker CE,仅测试了某些配置.您的操作系统的内核可能不支持每个存储驱动程序.通常,以下配置适用于Linux发行版的最新版本:

    Docker CE

    For Docker CE only some configurations are tested. Your operating system’s kernel may not support every storage driver. In general, the following configurations work on recent versions of the Linux distribution:

    Linux发行版支持的存储驱动程序 Ubuntu aufs,devicemapper,overlay2(Ubuntu 14.04.4或更高版本,16.04或更高版本),overlay,zfs上的Docker CE

    Linux distribution Supported storage drivers Docker CE on Ubuntu aufs, devicemapper, overlay2 (Ubuntu 14.04.4 or later, 16.04 or later), overlay, zfs

    https://github.com/moby/moby/issues/24023

    这篇关于无法在Ubuntu 16.04.2 LTS上启动Docker(初始化graphdriver出错)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆