准备看看docker服务怎么样
[root@localhost ~]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
这一看就是docker的进程崩了,我们启动下进程
[root@localhost ~]# systemctl start docker
Failed to start docker.service: Unit is not loaded properly: Bad message.
See system logs and 'systemctl status docker.service' for details.
启动不了,我们运行下 systemctl status docker.service 看看报错
[root@localhost ~]# systemctl status docker.service
● docker.service
Loaded: error (Reason: Bad message)
Active: inactive (dead)
Sep 16 08:32:02 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/docker.service:1] Invalid secti...nit'
Sep 16 08:32:02 localhost.localdomain systemd[1]: Cannot add dependency job for unit docker.service, ignor...age.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# vim /usr/lib/systemd/system/docker.service
[root@localhost ~]# systemctl status docker.service
● docker.service
Loaded: error (Reason: Bad message)
Active: inactive (dead)
Sep 16 08:32:02 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/docker.service:1] Invalid secti...nit'
Sep 16 08:32:02 localhost.localdomain systemd[1]: Cannot add dependency job for unit docker.service, ignor...age.
Hint: Some lines were ellipsized, use -l to show in full.
这些日志显示了 Docker 服务启动问题的原因。第一行提到了 /usr/lib/systemd/system/docker.service
文件的第一行存在一个 "Invalid section header" 错误。这意味着 systemd 在解析该文件时发现了问题。
我们打开 docker.service文件看看第一行
打开的时候发现第一行是 [Unit
缺了一个括号,我们补上
保存退出后再次运行看看
[root@localhost ~]# systemctl start docker
Failed to start docker.service: Unit is not loaded properly: Bad message.
See system logs and 'systemctl status docker.service' for details.
还是显示这个问题
突然想起重载下配置文件
systemctl daemon-reload
再次运行
systemctl start docker
服务正常启动文章来源:https://www.toymoban.com/news/detail-833637.html
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
可以查看服务了(服务就不展示了)文章来源地址https://www.toymoban.com/news/detail-833637.html
到了这里,关于分享一个docker无法启动的小问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!