Hi,

There's been a bit of discussion about the docker-image module recently.

In particular, see Toshio's post and my follow up here on the devel list:

https://groups.google.com/forum/#!topic/ansible-devel/ddlEteAgjIk

I'm currently feeling that docker-image got accepted too early, the normal
"docker" module is great, but Dockerfiles belong to be called from a build
system.

(A major reason for this is they also won't block ansible runs, and don't
make sense in host loops so much either)

Thoughts to the contrary would be welcome, but I'd suggest following -
http://www.ansible.com/blog/2014/02/12/installing-and-building-docker-with-ansible
for a primer on how to use playbooks inside a docker file - and we have
some suprises coming out about that hopefully this week that will simplify
further.

Hope that helps!

--Michael



On Tue, Sep 23, 2014 at 11:54 PM, Christopher Lamey <
[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/ansible-project/f47d3f96-31e2-48c2-a6a4-ff79c80d89ef%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgy3pRR_i1L-Hj7SJr-Eotm4krviooTC6cyP9FEd%3D7c9fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to