*# Failing on this task*
- name: Build the docker Nginx image
  docker_image:
    path: "{{ docker_nginx_dir }}"
    state: build
    name: nginx
--------------------------------------------------------------------------------------------

TASK: [nginx | Build the docker Nginx image] 
**********************************
fatal: [44.77.88.250] => failed to parse: 
SUDO-SUCCESS-nzlqhgvjgvzxsfarihtcrvrlkkyvqmao
{"msg": "Image builded: e2f95f10b413", "failed": false, "changed": true, 
"image_id": "e2f95f10b413"}
Traceback (most recent call last):
  File 
"/home/ubuntu/.ansible/tmp/ansible-tmp-1414453694.1-7307707817750/docker_image",
 
line 1455, in <module>
    main()
  File 
"/home/ubuntu/.ansible/tmp/ansible-tmp-1414453694.1-7307707817750/docker_image",
 
line 229, in main
    except docker.client.APIError as e:
AttributeError: 'module' object has no attribute 'APIError'

fatal: [44.77.52.190] => failed to parse: 
SUDO-SUCCESS-mtizmksvozxkbgrgfygkafkjpvvkrhkh
{"msg": "Image builded: 5f4ed49db019", "failed": false, "changed": true, 
"image_id": "5f4ed49db019"}
Traceback (most recent call last):
  File 
"/home/ec2-user/.ansible/tmp/ansible-tmp-1414453694.12-142535772268419/docker_image",
 
line 1455, in <module>
    main()
  File 
"/home/ec2-user/.ansible/tmp/ansible-tmp-1414453694.12-142535772268419/docker_image",
 
line 229, in main
    except docker.client.APIError as e:
AttributeError: 'module' object has no attribute 'APIError'


FATAL: all hosts have already failed -- aborting
--------------------------------------------------------------------------------------------

*Ansible Version:*
[email protected]:~/AnsiblePlaybooks/MicroService$ ansible --version
ansible 1.6.6
*Ansible host:*
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=13.10
    DISTRIB_CODENAME=saucy
    DISTRIB_DESCRIPTION="Ubuntu 13.10"
    NAME="Ubuntu"
    VERSION="13.10, Saucy Salamander"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 13.10"
    VERSION_ID="13.10"
*Managed docker host targets:*
*Ansible target 1*
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=14.04
    DISTRIB_CODENAME=trusty
    DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
    NAME="Ubuntu"
    VERSION="14.04.1 LTS, Trusty Tahr"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 14.04.1 LTS"
    VERSION_ID="14.04"

    $ sudo docker version
    Client version: 1.0.1
    Client API version: 1.12
    Go version (client): go1.2.1
    Git commit (client): 990021a
    Server version: 1.0.1
    Server API version: 1.12
    Go version (server): go1.2.1
    Git commit (server): 990021a

    $ pip show docker-py
    ---
    Name: docker-py
    Version: 0.5.3
    Location: /usr/local/lib/python2.7/dist-packages
    Requires: requests, six, websocket-client

    $ sudo docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED         
    VIRTUAL SIZE
    nginx               latest              e2f95f10b413        3 hours ago     
    236.3 MB
    ubuntu              trusty              5506de2b643b        4 days ago      
    197.8 MB

    $ python --version
    Python 2.7.6


*Ansible target 2*
    NAME="Amazon Linux AMI"
    VERSION="2014.09"
    ID="amzn"
    ID_LIKE="rhel fedora"
    VERSION_ID="2014.09"
    PRETTY_NAME="Amazon Linux AMI 2014.09"
    ANSI_COLOR="0;33"
    CPE_NAME="cpe:/o:amazon:linux:2014.09:ga"
    Amazon Linux AMI release 2014.09

    $ sudo docker version
    Client version: 1.2.0
    Client API version: 1.14
    Go version (client): go1.2
    Git commit (client): fa7b24f/1.2.0
    OS/Arch (client): linux/amd64
    Server version: 1.2.0
    Server API version: 1.14
    Go version (server): go1.2
    Git commit (server): fa7b24f/1.2.0

    $ pip show docker-py
    ---
    Name: docker-py
    Version: 0.5.3
    Location: /usr/lib/python2.6/site-packages
    Requires: requests, six, websocket-client

    $ sudo docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED         
    VIRTUAL SIZE
    nginx               latest              5f4ed49db019        26 minutes ago  
    236.3 MB
    ubuntu              trusty              5506de2b643b        4 days ago      
    197.8 MB

    $ python --version
    Python 2.6.9

*Docker file:*
    # Version 0.1
    FROM ubuntu:trusty
    MAINTAINER Ananda Debnath "[email protected]"

    # Install Nginx.
    RUN apt-get update && apt-get install -y nginx
    RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf


##### Expected Results:
If I try to build the dockerfile locally, it works fine.
*Ansible target 1:*
    $ sudo docker build -t test/local-nginx .
    Sending build context to Docker daemon  2.56 kB
    Sending build context to Docker daemon
    Step 0 : FROM ubuntu:trusty
     ---> 5506de2b643b
    Step 1 : MAINTAINER Ananda Debnath "[email protected]"
     ---> Using cache
     ---> 7a9f0bc9d34f
    Step 2 : RUN apt-get update && apt-get install -y nginx
     ---> Using cache
     ---> 03632e153793
    Step 3 : RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
     ---> Using cache
     ---> e2f95f10b413
    Successfully built e2f95f10b413

 
*Ansible target 2:*
    $ sudo docker build -t test/local-nginx .
    Sending build context to Docker daemon 12.29 kB
    Sending build context to Docker daemon
    Step 0 : FROM ubuntu:trusty
     ---> 5506de2b643b
    Step 1 : MAINTAINER Ananda Debnath "[email protected]"
     ---> Using cache
     ---> c702aae507bb
    Step 2 : RUN apt-get update && apt-get install -y nginx
     ---> Using cache
     ---> 993f4528ac1d
    Step 3 : RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
     ---> Using cache
     ---> 5f4ed49db019
    Successfully built 5f4ed49db019
--------------------------------------------------------------------------------------------


*I'm running ansible from an ubuntu 13.10 machine with ansible 1.6.6 on it. 
I'm using it to build two docker images for nginx on two target docker host 
machines. I'm running into the error above when trying to get docker to 
build the image specified in my Dockerfile. The dockerfiles seem to build 
locally just fine if I log on to the target machines and run docker 
manually. Also, they do seem to be building the images even though they 
report an error. What am I missing?*


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e5ae17aa-4e99-48a1-8818-cf99bfdf833b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to