Ubuntu18重启docker服务失败问题备忘

环境信息

  1. 操作系统:Ubuntu 18.04.2
  2. Docker:18.06.1-ce

现象

执行命令service restart docker,提示启动失败:

root@hedy:~# systemctl restart docker
Failed to restart docker.service: Unit docker.service not found.

原因

  1. 依稀记得这台机器上的Docker是用snap安装的,执行snap命令查看服务,果然看到了docker:
root@hedy:~# snap services
Service         Startup  Current  Notes
docker.dockerd  enabled  active   -
  1. 执行命令docker.help可以看到更多snap的信息:
root@hedy:~# docker.help
Docker snap: Docker Linux container runtime.

Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine.
We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic.

On Ubuntu classic, before installing the docker snap,
please run the following command to add the login user into docker group.
    sudo addgroup --system docker
    sudo adduser $USER docker
    newgrp docker

On Ubuntu Core 16, after installing the docker snap from store,
you need to connect the home interface as it's not auto-connected by default.
    sudo snap connect docker:home :home

Then have fun with docker in snappy.

正确的重启方式

执行命令snap restart docker即可重启docker服务:

root@hedy:~# snap restart docker
Restarted.

欢迎关注我的公众号:程序员欣宸

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员欣宸

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值