how get logs for docker service tasks on “preparing” state

前端 未结 2 1278
萌比男神i
萌比男神i 2021-02-20 04:39

I\'m playing around now with docker 1.12, created a service and noticed there is a stage of \"preparing\" when I ran \"docker service tasks xxx\".

相关标签:
2条回答
  • 2021-02-20 05:23

    I have been using docker-machine for emulating different "hosts" in my development environment.

    This is what I did to figure out what was going on during this "Preparing" phase for my services:

    docker service ps <serviceName>

    You should see the nodes (machines) where your service was scheduled to run. Here you'll see the "Preparing" message.

    Use docker-machine ssh to connect to a particular machine:

    docker-machine ssh <nameOfNode/Machine>
    

    Your prompt will change. You are now inside another machine. Inside this other machine do this:

    tail -f /var/log/docker.log

    You'll see the "daemon" log for that machine. There you'll see if that particular daemon is doing the "pull" or what's is doing as part of the service preparation. In my case, I found something like this:

    time="2016-09-05T19:04:07.881790998Z" level=debug msg="pull progress map[progress:[===========================================> ] 112.4 MB/130.2 MB status:Downloading

    Which made me realise that it was just downloading some images from my docker account.

    0 讨论(0)
  • 2021-02-20 05:39

    Your assumption (about pulling during preparation) is correct.

    There is no log command yet for tasks, but you could certainly connect to that daemon and do docker logs in the regular way.

    0 讨论(0)
提交回复
热议问题