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

ε祈祈猫儿з 提交于 2019-12-05 16:27:53

问题


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".

I can only guess that on this stage the images are being pulled or updated.

My question is: how can I see the logs for this stage? Or more generally: how can I see the logs for docker service tasks?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/38445371/how-get-logs-for-docker-service-tasks-on-preparing-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!