警告:停止docker.service,但它仍然可以通过以下方式激活:docker.socket

时间:2017-11-25 19:12:53

标签: docker debian vps

我重新安装了Docker。当我试图启动Docker时,一切都很好:

# /etc/init.d/docker start
[ ok ] Starting docker (via systemctl): docker.service.

直到我想停止Docker服务并多次重启它:

# /etc/init.d/docker stop

[....] Stopping docker (via systemctl): docker.serviceWarning: Stopping docker.service, but it can still be activated by:
  docker.socket
. ok 

最后,我有错误:

# /etc/init.d/docker start
[....] Starting docker (via systemctl): docker.serviceJob for docker.service failed.
See "systemctl status docker.service" and "journalctl -xe" for details.
 failed!

# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Sat 2017-11-25 20:04:20 CET; 2min 4s ago
     Docs: https://docs.docker.com
  Process: 12845 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=0/SUCCESS)
 Main PID: 12845 (code=exited, status=0/SUCCESS)
      CPU: 326ms

Nov 25 20:04:18 example.com systemd[1]: Started Docker Application Container Engine.
Nov 25 20:04:18 example.com dockerd[12845]: time="2017-11-25T20:04:18.191949863+01:00" level=inf
Nov 25 20:04:19 example.com systemd[1]: Stopping Docker Application Container Engine...
Nov 25 20:04:19 example.com dockerd[12845]: time="2017-11-25T20:04:19.368990531+01:00" level=inf
Nov 25 20:04:19 example.com dockerd[12845]: time="2017-11-25T20:04:19.37953454+01:00" level=info
Nov 25 20:04:20 example.com systemd[1]: Stopped Docker Application Container Engine.
Nov 25 20:04:21 example.com systemd[1]: docker.service: Start request repeated too quickly.
Nov 25 20:04:21 example.com systemd[1]: Failed to start Docker Application Container Engine.
Nov 25 20:04:21 example.com systemd[1]: docker.service: Unit entered failed state.
Nov 25 20:04:21 example.com systemd[1]: docker.service: Failed with result 'start-limit-hit'.

我在Debian 9 Stretch上安装了Docker。

任何人都可以帮我摆脱这个警告并解决错误“结果失败'start-limit-hit'”?

2 个答案:

答案 0 :(得分:7)

如果 docker 由套接字触发,只需启动和停止套接字。

sudo systemctl stop docker.socket

答案 1 :(得分:0)

这是因为除了docker.service单元文件外,还有一个docker.socket单元文件......这是用于套接字激活的。警告意味着如果您在docker服务未运行时尝试连接到docker socket,则systemd将自动为您启动docker。 您可以删除/lib/systemd/system/docker.socket来解决此问题...您可能还需要从-H fd://单元文件中删除docker.service