docker swarm how to find out why service can't start

后端 未结 1 1492
暖寄归人
暖寄归人 2020-12-22 23:04

I often have problems because a service that I deploy on docker swarm with multiple nodes won\'t start and there are not logs generated that I can look at with docker

相关标签:
1条回答
  • 2020-12-22 23:38

    I found one handy solution to the problem.

    docker service ps --no-trunc {serviceName}
    

    which will show errors with downloading images, mounting nfs volumes amongst others.

    ---------------------- UPDATE

    Not all errors can be found in the way described above. Another usefull tool is looking at the docker deamon logs which can be done the follwing way as explained on stackoverflow:

    journalctl -u docker.service | tail -n 50 
    

    It depends on your OS. Here are the few locations, with commands for few Operating Systems:

    • Ubuntu (old using upstart ) - /var/log/upstart/docker.log
    • Ubuntu (new using systemd ) - journalctl -u docker.service
    • Boot2Docker - /var/log/docker.log
    • Debian GNU/Linux - /var/log/daemon.log
    • CentOS - /var/log/daemon.log | grep docker
    • CoreOS - journalctl -u docker.service
    • Fedora - journalctl -u docker.service
    • Red Hat Enterprise Linux Server - /var/log/messages | grep docker
    • OpenSuSE - journalctl -u docker.service
    • OSX - ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/log/d‌​ocker.log
    • Windows - Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-5) | Sort-Object Time, as mentioned here.
    0 讨论(0)
提交回复
热议问题