Ubuntu18 restart docker service failed memo

Environmental information###

  1. Operating system: Ubuntu 18.04.2
  2. Docker:18.06.1-ce

phenomenon###

Execute the command service restart docker, prompting that the startup failed:

root@hedy:~# systemctl restart docker
Failed to restart docker.service: Unit docker.service not found.

the reason###

  1. I vaguely remember that Docker on this machine was installed with snap, execute the snap command to view the service, and I saw docker:
root@hedy:~# snap services
Service         Startup  Current  Notes
docker.dockerd  enabled  active   -
  1. Execute the command docker.help to see more snap information:
root@hedy:~# docker.help
Docker snap: Docker Linux container runtime.

Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine.
We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic.

On Ubuntu classic, before installing the docker snap,
please run the following command to add the login user into docker group.
 sudo addgroup --system docker
 sudo adduser $USER docker
 newgrp docker

On Ubuntu Core 16, after installing the docker snap from store,
you need to connect the home interfaceas it's not auto-connected by default.
 sudo snap connect docker:home :home

Then have fun with docker in snappy.

The correct way to restart###

Execute the command snap restart docker to restart the docker service:

root@hedy:~# snap restart docker
Restarted.

Recommended Posts

Ubuntu18 restart docker service failed memo
docker install ubuntu
Ubuntu startup service
Install docker on Ubuntu
CentOS 7 install Docker service
Install Docker on ubuntu18.04
Install Docker on Ubuntu18
Docker practice (1): install Docker on Ubuntu 16.04
Ubuntu Server Chapter 8 DNS Service
Open SSH service under Ubuntu
Open SSH service under Ubuntu
DNS service construction under Ubuntu
Install Docker on Ubuntu 18.04 offline