Failed to start docker.service: Unit docker.service is masked.
时间: 2023-10-23 08:30:50 浏览: 57
这个错误提示意味着Docker服务已被系统屏蔽,因此您无法启动它。您可以尝试使用以下命令解除屏蔽并启动docker服务:
1. 运行“sudo systemctl unmask docker.service”来解除屏蔽docker服务。
2. 运行“sudo systemctl start docker.service”来启动docker服务。
如果您仍然无法启动docker服务,可能需要更多的上下文信息来确定问题的根本原因。
相关问题
Failed to start docker.service: Unit is masked.
The error message "Failed to start docker.service: Unit is masked" typically indicates that the Docker service has been marked as masked, which means it is disabled and cannot be started. This can happen if there are issues with the Docker installation or if it has been intentionally masked by the system administrator.
To resolve this issue, you can try the following steps:
1. Unmask the Docker service: Run the following command to unmask the Docker service.
```
sudo systemctl unmask docker.service
```
2. Start the Docker service: Once the Docker service is unmasked, you can start it using the following command.
```
sudo systemctl start docker.service
```
3. Verify the status: After starting the Docker service, you can check its status to ensure it is running without any errors.
```
sudo systemctl status docker.service
```
If the issue persists or if you do not have administrative privileges to perform these actions, you may need to contact your system administrator for further assistance.
Failed to start docker.service: Unit not found.
这个错误是由于缺少docker.service文件引起的。docker.service是docker的systemd服务单元文件,它定义了docker服务的启动和停止行为。当这个文件不存在时,就会出现"Failed to start docker.service: Unit not found"的错误提示。为了解决这个问题,你可以按照以下步骤进行操作:
1. 确保你的系统中已经安装了docker。如果没有安装,请按照官方文档或相关教程进行安装。
2. 检查一下你的系统中是否存在docker.service文件。你可以在终端中运行以下命令来进行检查:
```
ls /usr/lib/systemd/system/docker.service
```
如果没有找到docker.service文件,那么就需要重新安装docker或者手动创建docker.service文件。
3. 如果你已经安装了docker,但是仍然找不到docker.service文件,那么你可以尝试重新安装docker。首先,卸载已经安装的docker:
```
sudo yum remove docker
```
然后,重新安装docker:
```
sudo yum install docker
```
4. 如果重新安装docker仍然没有解决问题,那么你可以尝试手动创建docker.service文件。首先,使用文本编辑器(如vi或nano)创建一个新文件:
```
sudo vi /usr/lib/systemd/system/docker.service
```
5. 在新创建的docker.service文件中,添加以下内容:
```
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
[Install]
WantedBy=multi-user.target
```
6. 保存并关闭文件。然后重新加载systemd配置:
```
sudo systemctl daemon-reload
```
7. 最后,尝试启动docker服务:
```
sudo systemctl start docker
```
如果一切顺利,你应该能够成功启动docker服务了。你可以使用以下命令来检查docker服务的状态:
```
sudo systemctl status docker
```
如果docker服务已经成功启动,你应该不再看到"Failed to start docker.service: Unit not found"的错误提示了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Failed to start docker.service: Unit not found](https://blog.csdn.net/weixin_48584982/article/details/124540002)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Failed to restart docker.service: Unit not found](https://blog.csdn.net/qq_15603633/article/details/122079687)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]