Hey,
I’m running ansible(1.6.1) on a ubuntu 12.04 and trying to start containers through the ansible docker module.
The Docker host machine is a 14.04 with Docker 0.9.1 and docker-py.
Building the image through ansible worked like a charm:
- name: check or build images
docker_image: path=/root/docker/ap53 name=th/ap53 state=present
But when i use the docker module:
- name: Starting containers
docker: image=th/ap53 name=n-ap33 state=present
This is what i get:
ESTABLISH CONNECTION FOR USER: root
REMOTE_MODULE docker image=th/ap53 name=n-ap33 state=present
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘n-dh04’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985 && echo $HOME/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985’”]
PUT /tmp/tmp4i84VW TO /root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/docker
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘n-dh04’, u"/bin/sh -c ‘LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/docker; rm -rf /root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/ >/dev/null 2>&1’"]
failed: [n-dh04] => {“failed”: true, “item”: “”, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/docker”, line 1922, in
main()
File “/root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/docker”, line 691, in main
containers = manager.create_containers(1)
File “/root/.ansible/tmp/ansible-tmp-1401183631.25-7365119312985/docker”, line 546, in create_containers
if docker.utils.compare_version(‘1.10’, self.client.version()[‘ApiVersion’]) < 0:
KeyError: ‘ApiVersion’
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_request_forwards: requesting forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 1417
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 0
Shared connection to n-dh04 closed.FATAL: all hosts have already failed – aborting
If i dont use the docker module but run it as a command:
- name: Start ap53 container
command: docker run -d -t -name n-ap53-2 th/ap53
Everything works fine.
So there’s something strange in the docker api, anyone bumped into this issue?