Failed to restart docker.service: Unit is masked.真正的解决办法

启动docker时报错

[root@localhost deployScript]# systemctl restart docker
Failed to restart docker.service: Unit is masked.

执行下面三条命令,无法解决问题

systemctl unmask docker.service

systemctl unmask docker.socket

systemctl start docker.service

查看docker状态systemctl status docker

● docker.service
   Loaded: masked (/usr/lib/systemd/system/docker.service; masked; vendor preset: disabled)
   Active: inactive (dead) since 二 2021-03-23 10:10:02 CST; 27min ago
 Main PID: 5587 (code=exited, status=0/SUCCESS)

3月 23 10:09:17 localhost.localdomain dockerd[5587]: time="2021-03-23T10:09:17.685725862+08:00" level=info msg="ignoring event" container=c87f56b9c6afccf8e1fba09a9e64c3e7da30d572f54faa49a744a9678e214eac module=libcontainerd namespace=moby topic=/tasks/del..."*events.TaskDelete"
3月 23 10:09:17 localhost.localdomain dockerd[5587]: time="2021-03-23T10:09:17.686604732+08:00" level=info msg="ignoring event" container=103d4a85755db466a88ea604dfee6d3dd105a4a0708a5e9d9f893d52f83f2d93 module=libcontainerd namespace=moby topic=/tasks/del..."*events.TaskDelete"
3月 23 10:09:26 localhost.localdomain dockerd[5587]: time="2021-03-23T10:09:26.228738793+08:00" level=info msg="Container 769f5905ee6caec852d9d7c4fc4907b149dcb4abf571b353453ce6b7839b3748 failed to exit within 10 seconds of signal 15 - using the force"
3月 23 10:09:29 localhost.localdomain dockerd[5587]: time="2021-03-23T10:09:29.326631372+08:00" level=info msg="ignoring event" container=769f5905ee6caec852d9d7c4fc4907b149dcb4abf571b353453ce6b7839b3748 module=libcontainerd namespace=moby topic=/tasks/del..."*events.TaskDelete"
3月 23 10:10:02 localhost.localdomain systemd[1]: Stopping docker.service...
3月 23 10:10:02 localhost.localdomain dockerd[5587]: time="2021-03-23T10:10:02.658687051+08:00" level=info msg="Processing signal 'terminated'"
3月 23 10:10:02 localhost.localdomain systemd[1]: Got notification message from PID 5587, but reception is disabled.
3月 23 10:10:02 localhost.localdomain dockerd[5587]: time="2021-03-23T10:10:02.688931348+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
3月 23 10:10:02 localhost.localdomain dockerd[5587]: time="2021-03-23T10:10:02.689429928+08:00" level=info msg="Daemon shutdown complete"
3月 23 10:10:02 localhost.localdomain systemd[1]: Stopped docker.service.
Hint: Some lines were ellipsized, use -l to show in full.

查看配置文件/usr/lib/systemd/system/docker.service,发现文件里面没有内容,从其他主机上拷贝内容过来,然后再执行systemctl start docker.service,问题解决。原因是异常操作导致docker服务被systemctl屏蔽。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值