ubuntu 18.04 docker安装

docker安装后不能正常启动,报错如下


$ sudo docker image ls
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?


systemctl status docker.service
● docker.service - LSB: Create lightweight, portable, self-sufficient containers.
   Loaded: loaded (/etc/init.d/docker; generated)
   Active: failed (Result: exit-code) since Tue 2018-06-05 15:18:48 CST; 6min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 28643 ExecStart=/etc/init.d/docker start (code=exited, status=1/FAILURE)
 Main PID: 9695 (code=exited, status=0/SUCCESS)

6月 05 15:18:48 MaLiJun-Ubuntu systemd[1]: Starting LSB: Create lightweight, portable, self-sufficient containers....
6月 05 15:18:48 MaLiJun-Ubuntu docker[28643]:  * /usr/bin/dockerd not present or not executable
6月 05 15:18:48 MaLiJun-Ubuntu systemd[1]: docker.service: Control process exited, code=exited status=1
6月 05 15:18:48 MaLiJun-Ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
6月 05 15:18:48 MaLiJun-Ubuntu systemd[1]: Failed to start LSB: Create lightweight, portable, self-sufficient containers..

  网上没有找到合适的当解决方案,耽误了很多时间,于是重新安装

从ubuntu 仓库直接下载最方便(不是安装的最新版):

$ sudo apt install docker.io

$ sudo systemctl start docker  
$ sudo systemctl enable docker

$ docker container ls --all