CentOS7上Docker 启动失败

版本信息:centos7、docker19.03.2(使用阿里镜像源下载的)

在使用sudo systemctl start docker命令启动docker时失败。

[vagrant@localhost ~]$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

日志信息:

[vagrant@localhost ~]$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Mon 2021-07-05 12:22:19 UTC; 4s ago
     Docs: https://docs.docker.com
  Process: 1191 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 1191 (code=exited, status=1/FAILURE)

Jul 05 12:22:17 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 05 12:22:17 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 05 12:22:17 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 05 12:22:17 localhost.localdomain systemd[1]: docker.service failed.
Jul 05 12:22:19 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
Jul 05 12:22:19 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
Jul 05 12:22:19 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
Jul 05 12:22:19 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 05 12:22:19 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 05 12:22:19 localhost.localdomain systemd[1]: docker.service failed.

解决方法:
在docker.service文件中加入阿里的镜像源。

  1. cd /usr/lib/systemd/system
  2. sudo vi docker.service
  3. 修改ExecStart后的值
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
# ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd --registry-mirror=https://ceqq2s09.mirror.aliyuncs.com
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

搞定~
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值