Public | Automated Build

Last pushed: 3 years ago
Short Description
Create a temporary container to run ansible 1.9
Full Description


Tested with boot2docker on OSX and virtualbox with Centos

With this docker image you can create a temporary container to run ansible(-playbook), after ansible is finished the container will be removed automatically.


  • Pull
    docker pull nickvth/dockerfile-ansible
  • Build

    cd /tmp/
    git clone 
    cd dockerfile-ansible
    docker build --force-rm=true --no-cache=true -t nickvth/dockerfile-ansible .
  • Create dir for ansible playbook and inventory file

    mkdir -p /mnt/ansible
  • Create aliases on your linux based system and test ansible

    alias ansible='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible'
    ansible --version
    ansible --help
    # Example
    ansible -i hosts testansible -u root -m setup
    alias ansible-playbook='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible-playbook'
    ansible-playbook --version
    ansible-playbook --help
  • ssh-agent needed for ssh password and mount playbook inside the container

    docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /bin/sh /
    [root@9d2cfb509f0e /]#ansible --version

    Set your alias in .bash_profile, so when you login the alias will be available

  • OSX:

  • Centos:
  • You can also make changes on the ansible.cfg and rebuild image if you want.
Docker Pull Command
Source Repository