command: docker pull sometimes hangs indefinitely

hi there,

i’m running a playbook for initializing my server that needs to pull a couple docker containers (and then start them).
The docker register is itself running in a docker container on localhost, so the tasks look like:
command: docker pull localhost:9000/org/container

I find that these sometimes hang indefinitely, and due to the way docker pull is implemented, are impossible to cancel.
When i add a -vvvv to my ansible-playbook command line, so i can get more information to diagnose the issue… they don’t hang!

is this familiar or sensible to anyone?

It’s probably that the command is asking for user input.

See if it offers any batch flags, or consider feeding it </dev/null using the ‘shell’ module.

Really I’d like to see much better module support for Docker, though I can’t really tell just yet what everyone is doing with it as people are doing different, mostly exploratory things.

Something I’m planning to poke around with some in the coming weeks.

I should also mention: I’m going to be writing a guide for the “Guides” section of the docs:

http://docs.ansible.com/guides.html

(we still have upgrades to the EC2 guide on our list – if people would like to jump in, just click a guide section and hit the “edit on github” button!)

thanks! - i will try that.

however when i run the command manually it doesn’t (seem to) need any input.
however it does do weird things to my terminal (it kinda overwrites its own previous lines, filling the terminal with a palimpsest of its own output, finishing by dropping a prompt somewhere in the middle of the jumble such that i immediately type “clear” if i don’t > /dev/null 2>&1 in the first place).

i tend to suspect that this problem is more on docker than on ansible; there’s a few people griping on the docker lists about how the pull command worked better in 0.6.7 than in 0.7.1… but i really can’t tell what’s going on.

here’s $0.03 on ansible’s current docker module:

my docker use includes building and tagging my own containers, pushing them to my repo, and then deploying them via docker pull ; docker run , ie i’m using docker containers as the build artifact that gets tested and deployed in my various environments. Of this workflow, the current module only supports running the containers, and according to the docs doesn’t work with docker 0.7.x, so i didn’t try it.
In fact i wrote an init.d script to service-ize my docker containers, so i’m using ansible’s service module to start/bounce them via that interface.
I could imagine a docker container state=pulled semantics, similar to service state=reloaded - i would find something along these lines quite helpful. (i think for building and pushing it would always be a shell command, since building is dependent on being in the same directory as the docker file…)

thanks again - overall i’m really enjoying using ansible and finding it much more straightforward and inviting than a certain culinary competitor…

just to close this thread, i tried a couple suggestions in tandem (not scientifically) and the following line is working for me:

shell: docker pull localhost:9000// < /dev/null 2>&1 | logger -p local2.notice -i

(where elsewhere i’ve configured syslog to send local2 to a file)

thanks!