call Dockerfiles inside ansible

17 views
Skip to first unread message

joe pinto

unread,
Aug 22, 2018, 1:14:35 PM8/22/18
to Ansible Project
I have one Dockerfile

I have tried :

 - name: build docker image
       command: docker build -t ansibleum /ze/Dockerfile


But the image was not created)

ansible-playbook old_copiash.yml -f 1



PLAY [Transfer and execute a script.] *********************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************************************
ok: [host2]
TASK [Transfer the script] ********************************************************************************************************************************************
ok: [host2]
TASK [Execute the script] *********************************************************************************************************************************************
changed: [host2]
TASK [build docker image] *********************************************************************************************************************************************
changed: [host2]
PLAY RECAP ************************************************************************************************************************************************************
host2                      : ok=4    changed=2    unreachable=0    failed=0
[root@localhost ze]# docker ps -q -a


I can I build an image using docker ?

thanks in advance

josé pinto

EspressoBeanies

unread,
Nov 12, 2018, 4:26:42 PM11/12/18
to Ansible Project
From seeing the available Docker modules, I'd say you can build Docker images, I'm just not sure if you can use Ansible to execute Dockerfiles. The documentation would say so, but it's a bit unclear as to how to achieve this. Not enough good examples.

EspressoBeanies

unread,
Nov 12, 2018, 4:36:32 PM11/12/18
to Ansible Project

Thad Guidry

unread,
Nov 12, 2018, 5:42:44 PM11/12/18
to ansible...@googlegroups.com
Yes, I would highly recommend you start using Ansible Container to build your docker containers.  You can even use the Ansible template module to automatically create the compose files you’ll need.



On Mon, Nov 12, 2018 at 3:36 PM EspressoBeanies <espress...@gmail.com> wrote:

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/55b113d7-f054-4caf-8916-1b4092b3681c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages