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

Ubuntu18重启docker服务失败问题备忘环境信息操作系统:Ubuntu18.04.2Docker:18.06.1-ce现象执行命令servicerestartdocker,提示启动失败:root@hedy:~#systemctlrestartdockerFailedtorestartdocker.service:Unitdocker.servicenotfound.原因依稀记得这台机器上…

大家好,欢迎来到IT知识分享网。

环境信息

  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.

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

在这里插入图片描述

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/15586.html

(0)

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信