【问题标题】:docker Job for docker.service failed because the control process exited with error codedocker.service 的 docker 作业失败,因为控制进程以错误代码退出
【发布时间】:2016-04-11 21:42:26
【问题描述】:

我花了更多时间在这里和外面学习很多帖子,但我没有找到解决方案,所以我来这里问:

我想在 manjaro linux 操作系统上运行 docker(类似archlinux)

uname -a
Linux boblinux-pc 4.1.15-1-MANJARO #1 SMP PREEMPT Tue Dec 15 07:48:44 UTC 2015 x86_64 GNU/Linux

安装 docker 后,我想启动它:

sudo systemctl start docker
Failed to start docker.service: Unit docker.socket failed to load: No such file or directory.

所以我有这个问题,所以我做到了:

systemctl cat docker
# /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
ExecStart=/usr/bin/docker daemon -H fd:// --exec-opt native.cgroupdriver=cgroupf
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/docker.service.d/lxc.conf
[Service]
ExecStart=
ExecStart=/usr/bin/docker -d -e lxc
....

我做到了:

systemctl cat docker.socket
# /usr/lib/systemd/system/docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target

好的,所以安装似乎没问题,所以错误消息说我要执行这个:

systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─lxc.conf
   Active: failed (Result: exit-code) since jeu. 2016-01-07 13:34:44 CET; 2min 0s ago
     Docs: https://docs.docker.com
  Process: 1970 ExecStart=/usr/bin/docker -d -e lxc (code=exited, status=1/FAILURE)
 Main PID: 1970 (code=exited, status=1/FAILURE)

janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.516598..."
janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.519014..."
janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.523254..."
janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.538260..."
janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.735998..."
janv. 07 13:34:44 boblinux-pc docker[1970]: time="2016-01-07T13:34:44.766801..."
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Main process exite...E
janv. 07 13:34:44 boblinux-pc systemd[1]: Failed to start Docker Application Container Engine.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Unit entered failed state.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: docker.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.

journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
      Users in the 'systemd-journal' group can see all messages. Pass -q to
      turn off this notice.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Main process exited, c
janv. 07 13:34:44 boblinux-pc systemd[1]: Failed to start Docker Application Con
-- Subject: L'unité (unit) docker.service a échoué
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) docker.service a échoué, avec le résultat failed.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Unit entered failed st
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Failed with result 'ex
janv. 07 13:34:44 boblinux-pc sudo[1963]: pam_unix(sudo:session): session closed
janv. 07 13:34:44 boblinux-pc polkitd[392]: Unregistered Authentication Agent fo
janv. 07 13:35:24 boblinux-pc systemd[1]: Starting Cleanup of Temporary Director
-- Subject: L'unité (unit) systemd-tmpfiles-clean.service a commencé à démarrer
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) systemd-tmpfiles-clean.service a commencé à démarrer.
janv. 07 13:35:24 boblinux-pc systemd[1]: Started Cleanup of Temporary Directori
-- Subject: L'unité (unit) systemd-tmpfiles-clean.service a terminé son démarrag
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) systemd-tmpfiles-clean.service a terminé son démarrage, avec l
lines 1695-1717/1717 (END)
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
janv. 07 13:34:44 boblinux-pc systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: L'unité (unit) docker.service a échoué
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) docker.service a échoué, avec le résultat failed.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Unit entered failed state.
janv. 07 13:34:44 boblinux-pc systemd[1]: docker.service: Failed with result 'exit-code'.
janv. 07 13:34:44 boblinux-pc sudo[1963]: pam_unix(sudo:session): session closed for user root
janv. 07 13:34:44 boblinux-pc polkitd[392]: Unregistered Authentication Agent for unix-process:1964:86659 (system bus name :1.41, obje
janv. 07 13:35:24 boblinux-pc systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: L'unité (unit) systemd-tmpfiles-clean.service a commencé à démarrer
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) systemd-tmpfiles-clean.service a commencé à démarrer.
janv. 07 13:35:24 boblinux-pc systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: L'unité (unit) systemd-tmpfiles-clean.service a terminé son démarrage
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- L'unité (unit) systemd-tmpfiles-clean.service a terminé son démarrage, avec le résultat done.

我尝试了很多东西,但我没有找到解决方案,所以如果有人可以帮助我,谢谢你们,对不起我的英语不好,我不是英语=D

【问题讨论】:

    标签: linux service docker systemd


    【解决方案1】:

    所以,这是管理用户/组的问题,

    我尝试使用 sudo 来使用 docker 拉 ubuntu:

    sudo docker pull ubuntu
    Using default tag: latest
    latest: Pulling from library/ubuntu
    fcee8bcfe180: Pull complete 
    4cdc0cbc1936: Pull complete 
    d9e545b90db8: Pull complete 
    c4bea91afef3: Pull complete 
    Digest: sha256:b53bb7b0d18842214ac7472c2a8801e8682c247d30f1ba4bab0083a2e2e091ea
    Status: Downloaded newer image for ubuntu:latest
    

    在这里我尝试运行它,它可以工作! :

    sudo docker run -it --name ubuntu ubuntu
    pass [sudo] de boblinux :
    root@3a99cdd1c522:/# ls
    bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
    boot  etc  lib   media  opt  root  sbin  sys  usr
    root@3a99cdd1c522:/# exit
    exit
    

    【讨论】:

      【解决方案2】:

      我也遇到过同样的问题,但上述解决方案没有帮助。我不得不重新安装 docker 才能让它重新运行。我怀疑这个问题是我调整了安装 docker 的实例的大小(内存扩大了)。

      【讨论】:

      • 可能是因为新实例的主机名不同。
      【解决方案3】:

      以下解决方案对我有用

      您需要删除清理旧的本地存储库。通过使用以下命令。

      rm -rf /var/lib/docker

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-20
        • 2019-12-31
        • 1970-01-01
        相关资源
        最近更新 更多