Hello,

I'm trying to use Docker with Ansible to build a Docker image, but am 
running into an issue.  Any help would be appreciated.

Basically, I want to put my docker files in my role's 'files' directory and 
not have to specify a path for the docker_image task.  Or, if I do have to 
specify a path, I'd like it to be relative.

Ansible -> v1.7.1
Python ->2.7.6
Docker-py -> 0.5.0

Relevant bit of my Ansible files look like this, following the Best 
Practices section of the docs:

roles/jenkins-slave/tasks/main.yml
> roles/jenkins-slave/files/Dockerfile


My task in that main.yml looks like this:

- name: check or build jenkins-slave image
>   docker_image: name=jenkins_java8 state=present


Note the lack of a path variable, which according to the docs is not a 
required field.

When I run ansible-playbook, which then runs that task, I get this:

TASK: [jenkins-slave | check or build jenkins-slave image] 
> ********************
> fatal: [bucket1.closely.com] => failed to parse: 
> SUDO-SUCCESS-pmqhkrvacsxgejgtwrskjhunvzyegvbj
> Traceback (most recent call last):
> File 
> "/home/closely/.ansible/tmp/ansible-tmp-1411528307.53-162772271271910/docker_image",
>  
> line 1598, in <module>
> main()
> File 
> "/home/closely/.ansible/tmp/ansible-tmp-1411528307.53-162772271271910/docker_image",
>  
> line 234, in main
> image_id = manager.build()
> File 
> "/home/closely/.ansible/tmp/ansible-tmp-1411528307.53-162772271271910/docker_image",
>  
> line 139, in build
> stream = self.client.build(self.path, tag=':'.join([self.name, self.tag]), 
> nocache=self.nocache, rm=True, stream=True)
> File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 386, 
> in build
> raise TypeError("Either path or fileobj needs to be provided.")
> TypeError: Either path or fileobj needs to be provided.
>
>
>
> FATAL: all hosts have already failed -- aborting

 
Specifying an absolute path for docker_image works, but that seems less 
than ideal.  I haven't found a relative path that works at all.

I'm admittedly a n00b to Ansible, so it's very likely I'm missing something 
very basic here.  Any kind of debugging help would be useful too - like how 
could I trap the actual issued command to see what it thinks the path is?

Thanks,
topher

-- 
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/f47d3f96-31e2-48c2-a6a4-ff79c80d89ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to