Unit docker.service not found

docker.service can’t start. The OS is Ubuntu 18.04.

$ sudo service docker start
Failed to start docker.service: Unit docker.service not found.

Restart doesn’t work:
$ sudo systemctl restart docker
Failed to restart docker.service: Unit docker.service not found.

Reinstall docker doesn’t work as well.

Some log may help:

$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.06.1-ce
Storage Driver: aufs
Root Dir: /var/snap/docker/common/var-lib-docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: N/A (expected: 69663f0bd4b60df09991c08812a60108003fa340)
init version: 949e6fa (expected: fec3683)
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.18.0-20-generic
Operating System: Ubuntu Core 16
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.55GiB
Name: root-OptiPlex-7050
ID: TA44:3SS4:PB47:ABPR:I2GI:GLQX:YHBL:N724:2KDS:75MN:YTGY:ZKQK
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
Goroutines: 43
System Time: 2019-06-03T13:29:49.18832205-04:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false


Root Dir: /var/snap/docker/common/var-lib-docker/aufs

Docker Root Dir: /var/snap/docker/common/var-lib-docker

Since you’re using docker from snap, use snap to start docker :

snap start docker

This probably requiere root permission, you might want to use sudo and maybe restart instead of start