Unit docker.service not found.
时间: 2023-12-22 12:06:39 浏览: 285
Unit docker.service not found的原因是CentOS默认使用podman代替docker。为了解决这个问题,您需要将podman卸载并重新安装docker。
以下是解决该问题的步骤:
1. 在终端中输入以下命令卸载podman:
```
sudo yum remove podman
```
2. 安装docker:
```
sudo yum install docker
```
3. 启动docker服务:
```
sudo systemctl start docker
```
4. 验证docker是否成功启动:
```
sudo systemctl status docker
```
如果一切顺利,您应该能看到docker服务已经成功启动,并且不再报错"Unit docker.service not found"。
相关问题
Failed to start docker.service: Unit docker.service not found.
As an AI language model, I do not have access to the environment in which this error occurred. However, this error message suggests that the Docker service is not installed or running on the system.
To resolve this issue, you can try installing Docker using the following commands:
1. Update the package list:
`sudo apt-get update`
2. Install the dependencies:
`sudo apt-get install apt-transport-https ca-certificates curl software-properties-common`
3. Add the Docker GPG key:
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`
4. Add the Docker repository:
`sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"`
5. Update the package list again:
`sudo apt-get update`
6. Install Docker:
`sudo apt-get install docker-ce`
After installing Docker, you can start the Docker service using the following command:
`sudo service docker start`
If the issue persists, you may need to check your system logs and investigate further.
failed to start docker.service: unit docker.service not found.
这个错误是因为缺少docker.service这个单元。解决这个问题的方法有以下几种:
1. 如果你使用的是Red Hat Enterprise Linux 7,可以通过安装rhel-push-plugin软件包来解决。执行以下指令即可:
```
curl -sSL https://get.docker.com/ | sh
```
2. 如果你使用的是CentOS,并且出现了这个错误,可能是因为CentOS默认使用podman代替docker。你可以通过以下步骤解决:
1. 输入以下指令卸载podman和buildah:
```
yum erase podman buildah
```
2. 输入y并等待卸载完成。
3. 安装Docker,可以按照以下步骤进行:
1. 安装依赖环境:
```
yum install -y yum-utils
```
2. 配置阿里云镜像:
```
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
```
3. 安装Docker CE:
```
sudo yum install -y docker-ce docker-ce-cli containerd.io
```
4. 启动Docker服务:
```
systemctl start docker
```
阅读全文