Shay Tsadok
Shay Tsadok

Reputation: 933

how get logs for docker service tasks on "preparing" state

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?

Upvotes: 13

Views: 10477

Answers (2)

cSn
cSn

Reputation: 2906

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.

Upvotes: 11

johnharris85
johnharris85

Reputation: 18926

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.

Upvotes: 0

Related Questions