美文网首页收藏文章Linux
docker学习笔记补充:记一次docker启动失败的问题

docker学习笔记补充:记一次docker启动失败的问题

作者: Seaofdesire | 来源:发表于2018-04-23 12:07 被阅读0次
    • 背景
      docker swarm集群已搭建好,可正常部署应用

      节点 ip 描述
      vm1 192.168.0.100 manager节点
      vm2 192.168.0.101 worker节点
    • 问题
      使用vm1 manager节点执行docker-machine create --driver generic命令后,vm2启动出错:

    [root@00 docker.service.d]# systemctl start docker.service
    Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
    

    使用systemctl status docker.service查看

    [root@00 docker.service.d]# systemctl status docker
    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/docker.service.d
               └─10-machine.conf
       Active: failed (Result: start-limit) since Mon 2018-04-23 10:28:48 CST; 5min ago
         Docs: https://docs.docker.com
     Process: 4206 ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver devicemapper --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --registry-mirror https://xxx.mirror.aliyuncs.com (code=exited, status=1/FAILURE)
     Main PID: 4312 (code=exited, status=1/FAILURE)
    
    Apr 23 10:28:48 fishServer00 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    Apr 23 10:28:48 fishServer00 systemd[1]: Failed to start Docker Application Container Engine.
    Apr 23 10:28:48 fishServer00 systemd[1]: Unit docker.service entered failed state.
    Apr 23 10:28:48 fishServer00 systemd[1]: docker.service failed.
    Apr 23 10:28:48 fishServer00 systemd[1]: docker.service holdoff time over, scheduling restart.
    Apr 23 10:28:48 fishServer00 systemd[1]: start request repeated too quickly for docker.service
    Apr 23 10:28:48 fishServer00 systemd[1]: Failed to start Docker Application Container Engine.
    Apr 23 10:28:48 fishServer00 systemd[1]: Unit docker.service entered failed state.
    Apr 23 10:28:48 fishServer00 systemd[1]: docker.service failed.
    Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    

    查看详细日志:

    journalctl -xe
    

    看这个,大概意思是docker启动时受在这个目录下的10-machine.cnf影响冲突。这个文件大概是在docker-machine create时产生的(未验证)。因为我在daemon.json文件中配置了镜像地址,在docker-machine create时候又指定了镜像,可能导致冲突了:

    Drop-In: /etc/systemd/system/docker.service.d
               └─10-machine.conf
    
     Process: 4312 ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver devicemapper --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --registry-mirror https://xxxx.mirror.aliyuncs.com (code=exited, status=1/FAILURE)
    

    解决方案

    删除 /etc/systemd/system/docker.service.d下的10-machine.conf文件,

    mv 10-machine.conf 10-machine.conf-bak
    

    执行systemctl daemon-reload

    systemctl daemon-reload
    

    重新启动docker

    systemctl start docker.service
    

    ok,大功告成

    相关文章

      网友评论

        本文标题:docker学习笔记补充:记一次docker启动失败的问题

        本文链接:https://www.haomeiwen.com/subject/vxuklftx.html