运行systemctl时Failed to restart docker.service: Unit not found.
时间: 2023-12-04 15:09:25 浏览: 101
这可能是因为Docker服务未正确安装或已被删除。尝试重新安装Docker并启动服务:
1.卸载旧版本的Docker:
sudo apt-get remove docker docker-engine docker.io containerd runc
2.更新apt软件包索引和安装必要的软件包:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3.添加Docker的GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.添加Docker的软件源:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5.更新apt软件包索引并安装Docker:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
6.启动Docker服务:
sudo systemctl start docker
7.检查Docker服务状态:
sudo systemctl status docker
如果Docker服务已正确安装并启动,则应该看到“active (running)”状态。
阅读全文