V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
DaChuiZi
V2EX  ›  Docker

docker 服务启动不起来了,各种方式尝试了,菜鸟求关爱~

  •  
  •   DaChuiZi · 2023-04-11 16:03:42 +08:00 · 1649 次点击
    这是一个创建于 375 天前的主题,其中的信息可能已经有所发展或是发生改变。

    docker 服务启动不起来了 怀疑是因为,容器设置了 docker 服务 容器自启动 ip6s3w.png ip6v5a.png

    17 条回复    2023-04-12 19:14:28 +08:00
    newjuzi
        1
    newjuzi  
       2023-04-11 16:19:37 +08:00
    看看 restart 的控制台输出,有可能进程还没死,所以起不来
    DaChuiZi
        2
    DaChuiZi  
    OP
       2023-04-11 16:23:20 +08:00
    @newjuzi
    (base) [root@localhost ~]# systemctl restart docker
    Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
    直接提示这个,然后就是我图里的样子
    newjuzi
        3
    newjuzi  
       2023-04-11 16:44:39 +08:00
    ps 看看 docker 进程有没有残留,有的话删掉
    DaChuiZi
        4
    DaChuiZi  
    OP
       2023-04-11 16:52:45 +08:00
    @newjuzi 没有残留啊
    putaozhenhaochi
        5
    putaozhenhaochi  
       2023-04-11 19:00:29 +08:00 via Android
    devicemapper.conf 文件里把--graph 改成--data-root
    hefish
        6
    hefish  
       2023-04-11 19:31:35 +08:00
    看起来可能是启动参数的问题。 就是那个 /home/docker_pro/lib/docker
    aogg
        7
    aogg  
       2023-04-12 09:14:47 +08:00
    journalctl -xe 就是要执行这个命令看错误的,这是看真实报错信息的命令
    baobao1270
        8
    baobao1270  
       2023-04-12 10:00:45 +08:00
    journalctl -u docker -f 看看?

    我推测是权限问题,检查一下权限,还有如果有 SELinux 可以尝试关掉
    julyclyde
        9
    julyclyde  
       2023-04-12 10:10:20 +08:00
    systemctl status 显示的日志内容比较少
    但实际上产生了很多,结果就导致真正想看的内容都已经“滚动”过去了

    应该用 journalctl -u docker 来查看
    DaChuiZi
        10
    DaChuiZi  
    OP
       2023-04-12 12:44:08 +08:00
    @baobao1270
    (base) [root@localhost docker_pro]# journalctl -u docker -f
    -- Logs begin at 六 2023-03-11 08:28:06 CST. --
    4 月 12 09:33:30 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 12 09:33:30 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 09:33:30 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 09:33:30 localhost.localdomain systemd[1]: docker.service failed.
    4 月 12 09:33:33 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 12 09:33:33 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 12 09:33:33 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
    4 月 12 09:33:33 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 09:33:33 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 09:33:33 localhost.localdomain systemd[1]: docker.service failed.
    4 月 12 12:43:54 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
    4 月 12 12:43:54 localhost.localdomain dockerd[28970]: Flag --graph has been deprecated, Use --data-root instead
    4 月 12 12:43:54 localhost.localdomain dockerd[28970]: the "graph" config file option is deprecated; use "data-root" instead
    4 月 12 12:43:54 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 12 12:43:54 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 12:43:54 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 12:43:54 localhost.localdomain systemd[1]: docker.service failed.
    4 月 12 12:43:57 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 12 12:43:57 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 12 12:43:57 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
    4 月 12 12:43:57 localhost.localdomain dockerd[29018]: Flag --graph has been deprecated, Use --data-root instead
    4 月 12 12:43:57 localhost.localdomain dockerd[29018]: the "graph" config file option is deprecated; use "data-root" instead
    4 月 12 12:43:57 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 12 12:43:57 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 12:43:57 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 12:43:57 localhost.localdomain systemd[1]: docker.service failed.
    4 月 12 12:43:59 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 12 12:43:59 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 12 12:43:59 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
    4 月 12 12:43:59 localhost.localdomain dockerd[29170]: Flag --graph has been deprecated, Use --data-root instead
    4 月 12 12:43:59 localhost.localdomain dockerd[29170]: the "graph" config file option is deprecated; use "data-root" instead
    4 月 12 12:43:59 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 12 12:43:59 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 12:43:59 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 12:43:59 localhost.localdomain systemd[1]: docker.service failed.
    4 月 12 12:44:01 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 12 12:44:01 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 12 12:44:01 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
    4 月 12 12:44:01 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 12 12:44:01 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 12 12:44:01 localhost.localdomain systemd[1]: docker.service failed.
    DaChuiZi
        11
    DaChuiZi  
    OP
       2023-04-12 12:50:26 +08:00
    @hefish

    这是我的 docker.service 文件内容,我尝试更换 ExecStart 还是无法启动

    1 [Unit]
    2 Description=Docker Application Container Engine
    3 Documentation=https://docs.docker.com
    4 After=network-online.target docker.socket firewalld.service containerd.service time-set.target
    5 Wants=network-online.target containerd.service
    6 Requires=docker.socket
    7
    8 [Service]
    9 Type=notify
    10 # the default is not to use systemd for cgroups because the delegate issues still
    11 # exists and systemd currently does not support the cgroup feature set required
    12 # for containers run by docker
    13 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    14 #ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --graph=/home/docker_pro/lib/docker
    15 #ExecStart=/usr/bin/dockerd -H fd:// -s overlay2
    16 #ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
    17 ExecReload=/bin/kill -s HUP $MAINPID
    18 TimeoutStartSec=0
    19 RestartSec=2
    20 Restart=always
    21
    22 # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
    23 # Both the old, and new location are accepted by systemd 229 and up, so using the old location
    24 # to make them work for either version of systemd.
    25 StartLimitBurst=3
    26
    27 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
    28 # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
    29 # this option work for either version of systemd.
    30 StartLimitInterval=60s
    31
    32 # Having non-zero Limit*s causes performance problems due to accounting overhead
    33 # in the kernel. We recommend using cgroups to do container-local accounting.
    34 LimitNOFILE=infinity
    35 LimitNPROC=infinity
    36 LimitCORE=infinity
    37
    38 # Comment TasksMax if your systemd version does not support it.
    39 # Only systemd 226 and above support this option.
    40 TasksMax=infinity
    41
    42 # set delegate yes so that systemd does not reset the cgroups of docker containers
    43 Delegate=yes
    44
    45 # kill only the docker process, not all processes in the cgroup
    46 KillMode=process
    47 OOMScoreAdjust=-500
    48
    49 [Install]
    50 WantedBy=multi-user.target
    DaChuiZi
        12
    DaChuiZi  
    OP
       2023-04-12 12:51:03 +08:00
    @putaozhenhaochi 这个文件没有找到呀
    DaChuiZi
        13
    DaChuiZi  
    OP
       2023-04-12 13:05:01 +08:00
    @baobao1270 SELinux 这个一直关着呢

    4 月 06 20:41:03 localhost.localdomain systemd[1]: Stopping Docker Application Container Engine...
    4 月 06 20:41:03 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:03.235254656+08:00" level=info msg="Processing signal 'terminated'"
    4 月 06 20:41:03 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:03.940421095+08:00" level=info msg="ignoring event" container=5a1fdd52ebd116a6690a8cf87e9c2171a75d11eb3b0218a64dca1e3fa13d1146 module=libcontainerd namespa
    4 月 06 20:41:03 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:03.956712917+08:00" level=info msg="ignoring event" container=21843bfebcf7fd7fe215e3a84566dfa215384bb2dbdfd57c81c0139fd3fd502a module=libcontainerd namespa
    4 月 06 20:41:03 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:03.965155048+08:00" level=info msg="ignoring event" container=0d058d00d03ed6fb4eb94401388156d4efde0af57f7144de0f683bdd4d4bd37c module=libcontainerd namespa
    4 月 06 20:41:13 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:13.403053362+08:00" level=info msg="Container failed to exit within 10s of signal 15 - using the force" container=b773a2c4985d83489a94e511ff09c6782730d6435
    4 月 06 20:41:13 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:13.403081127+08:00" level=info msg="Container failed to exit within 10s of signal 15 - using the force" container=4d96b2b327fda9b5c20e2bc7b0eaec29b1db66e3a
    4 月 06 20:41:14 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:14.107149491+08:00" level=info msg="ignoring event" container=b773a2c4985d83489a94e511ff09c6782730d643591b17d2961860f5024ec8a3 module=libcontainerd namespa
    4 月 06 20:41:15 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:15.679730340+08:00" level=info msg="ignoring event" container=4d96b2b327fda9b5c20e2bc7b0eaec29b1db66e3af6fd8d38bfe8fad73109276 module=libcontainerd namespa
    4 月 06 20:41:18 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:18.150350612+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
    4 月 06 20:41:18 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:18.172093522+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
    4 月 06 20:41:18 localhost.localdomain dockerd[10575]: time="2023-04-06T20:41:18.209248869+08:00" level=info msg="Daemon shutdown complete"
    4 月 06 20:41:20 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 06 20:41:20 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
    4 月 06 20:41:20 localhost.localdomain dockerd[3806]: Flag --graph has been deprecated, Use --data-root instead

    docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 11 14:51:37 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 11 14:51:37 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 11 14:51:37 localhost.localdomain systemd[1]: docker.service failed.
    4 月 11 14:51:39 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 11 14:51:39 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    4 月 11 14:51:39 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
    4 月 11 14:51:39 localhost.localdomain dockerd[37736]: Flag --graph has been deprecated, Use --data-root instead
    4 月 11 14:51:39 localhost.localdomain dockerd[37736]: unable to configure the Docker daemon with file /etc/docker/daemon.json: merged configuration validation from file and command line flags failed: the "graph" config file option i
    4 月 11 14:51:39 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    4 月 11 14:51:39 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
    4 月 11 14:51:39 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
    4 月 11 14:51:39 localhost.localdomain systemd[1]: docker.service failed.
    4 月 11 14:51:41 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
    4 月 11 14:51:41 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
    hefish
        14
    hefish  
       2023-04-12 15:01:07 +08:00
    他说 graph 这个 config file option 已经 deprecated 了。。试试换一个。 另外感觉开个 debug 看看吧。 启动命令行加个 --debug 参数
    DaChuiZi
        15
    DaChuiZi  
    OP
       2023-04-12 15:23:32 +08:00
    @hefish
    目前 DEBUG 状态:
    DEBU[2023-04-12T15:23:00.413620166+08:00] Registering GET, /nodes
    DEBU[2023-04-12T15:23:00.413686576+08:00] Registering GET, /nodes/{id}
    DEBU[2023-04-12T15:23:00.413754902+08:00] Registering DELETE, /nodes/{id}
    DEBU[2023-04-12T15:23:00.413827184+08:00] Registering POST, /nodes/{id}/update
    DEBU[2023-04-12T15:23:00.413914670+08:00] Registering GET, /tasks
    DEBU[2023-04-12T15:23:00.413960647+08:00] Registering GET, /tasks/{id}
    DEBU[2023-04-12T15:23:00.414073557+08:00] Registering GET, /tasks/{id}/logs
    DEBU[2023-04-12T15:23:00.414166017+08:00] Registering GET, /secrets
    DEBU[2023-04-12T15:23:00.414242944+08:00] Registering POST, /secrets/create
    DEBU[2023-04-12T15:23:00.414312802+08:00] Registering DELETE, /secrets/{id}
    DEBU[2023-04-12T15:23:00.414394615+08:00] Registering GET, /secrets/{id}
    DEBU[2023-04-12T15:23:00.414472884+08:00] Registering POST, /secrets/{id}/update
    DEBU[2023-04-12T15:23:00.414552060+08:00] Registering GET, /configs
    DEBU[2023-04-12T15:23:00.414600410+08:00] Registering POST, /configs/create
    DEBU[2023-04-12T15:23:00.414665823+08:00] Registering DELETE, /configs/{id}
    DEBU[2023-04-12T15:23:00.414746947+08:00] Registering GET, /configs/{id}
    DEBU[2023-04-12T15:23:00.414835990+08:00] Registering POST, /configs/{id}/update
    DEBU[2023-04-12T15:23:00.414927111+08:00] Registering GET, /plugins
    DEBU[2023-04-12T15:23:00.414977201+08:00] Registering GET, /plugins/{name:.*}/json
    DEBU[2023-04-12T15:23:00.415067523+08:00] Registering GET, /plugins/privileges
    DEBU[2023-04-12T15:23:00.415134229+08:00] Registering DELETE, /plugins/{name:.*}
    DEBU[2023-04-12T15:23:00.415211335+08:00] Registering POST, /plugins/{name:.*}/enable
    DEBU[2023-04-12T15:23:00.415322755+08:00] Registering POST, /plugins/{name:.*}/disable
    DEBU[2023-04-12T15:23:00.415413477+08:00] Registering POST, /plugins/pull
    DEBU[2023-04-12T15:23:00.415470411+08:00] Registering POST, /plugins/{name:.*}/push
    DEBU[2023-04-12T15:23:00.415556849+08:00] Registering POST, /plugins/{name:.*}/upgrade
    DEBU[2023-04-12T15:23:00.415660491+08:00] Registering POST, /plugins/{name:.*}/set
    DEBU[2023-04-12T15:23:00.415742536+08:00] Registering POST, /plugins/create
    DEBU[2023-04-12T15:23:00.415811629+08:00] Registering GET, /distribution/{name:.*}/json
    DEBU[2023-04-12T15:23:00.415911141+08:00] Registering POST, /grpc
    DEBU[2023-04-12T15:23:00.415964359+08:00] Registering GET, /networks
    DEBU[2023-04-12T15:23:00.416037943+08:00] Registering GET, /networks/
    DEBU[2023-04-12T15:23:00.416095591+08:00] Registering GET, /networks/{id:.+}
    DEBU[2023-04-12T15:23:00.416179564+08:00] Registering POST, /networks/create
    DEBU[2023-04-12T15:23:00.416232961+08:00] Registering POST, /networks/{id:.*}/connect
    DEBU[2023-04-12T15:23:00.416325014+08:00] Registering POST, /networks/{id:.*}/disconnect
    DEBU[2023-04-12T15:23:00.416412172+08:00] Registering POST, /networks/prune
    DEBU[2023-04-12T15:23:00.416481136+08:00] Registering DELETE, /networks/{id:.*}
    INFO[2023-04-12T15:23:00.416758884+08:00] API listen on /var/run/docker.sock
    DaChuiZi
        16
    DaChuiZi  
    OP
       2023-04-12 17:38:08 +08:00
    配置冲突了 把 /etc/docker/daemon.json
    中的 graph 删除, 把
    这个下边的配置文件更改一下:
    /etc/systemd/system/docker.service.d
    (base) [root@localhost docker.service.d]# cat devicemapper.conf
    [Service]
    ExecStart=
    ExecStart=/usr/bin/dockerd --data-root=/home/docker_pro/lib/docker

    启动成功了
    julyclyde
        17
    julyclyde  
       2023-04-12 19:14:28 +08:00
    你这个 service 文件从哪儿来的?不是和 docker 配套安装过来的吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2944 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:02 · PVG 17:02 · LAX 02:02 · JFK 05:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.