Tag Archives: Ubuntu20.04 server Error

Ubuntu20.04 server Error: Failed to restart docker.service: Unit docker.service not found

1. Reasons

This is because I did not use the official installation package or apt to install docker, but I chose to install docker together when installing Ubuntu, so I installed it with snap

2. Phenomenon

sudo systemctl restart docker
sudo service docker restart
sudo systemctl start docker.service

However, errors are always reported:
failed to restart docker.service: unit docker.service not found

3. Order to solve the problem

sudo snap restart docker

4. Other usages of snap package management tool

snap list     To view the package installed by snap:

sudo snap restart docker     Restart docker
sudo snap remove docker    Uninstall docker

5. Uninstall and reinstall docker

6. Install docker-compose