Not able to start docker on Ubuntu 16.04.2 LTS (error initializing graphdriver)

Viewed 5943

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'.
3 Answers

I had installed Docker on my server which ran Debian Jessie. I removed Docker and upgraded my server to Debian Stretch. But the systemd configuration file /etc/systemd/system/docker.service.d/execWithDeviceMapper.conf was not removed. The file had the configuration: storage-engine: devicemapper. The devicemapper storage engine does not work well with Debian Stretch.

I deleted the systemd configuration folder /etc/systemd/system/docker.service.d. I used the command: apt-get install docker-ce docker-ce-cli containerd.io to install Docker without problems.

As described in a blog post by Rowanto it can help to delete the /var/lib/docker/aufs before restarting docker.

You might lose some data (e.g. images, containers), so please do it with care!

sudo rm -rf /var/lib/docker/aufs

After that restart docker:

sudo service docker start
Related