Docker Inception

Contents

Ansible building docker to build docker containers with ansible?

Why would I want to do this?

We need a standardised environment that has Ansible and Packer installed in order to build Docker & Amazon AMI images.

This environment may as well be a Docker container, which we may as well build using Ansible as it allows us to keep the Dockerfile simple.

Ansible can provide us a base Docker image available in the registry

Useful resources

Ansible bootstrapped Dockerfile

The Dockerfile for this is very simple and can be extended to add Packer and other utilities needed to build our images

# Latest version of centos
FROM centos:centos7
MAINTAINER Toshio Kuratomi <tkuratomi@ansible.com>
RUN yum clean all && \
    yum -y install epel-release && \
    yum -y install PyYAML python-jinja2 python-httplib2 python-keyczar python-paramiko python-setuptools git python-pip
RUN mkdir /etc/ansible/
RUN echo '[local]\nlocalhost\n' > /etc/ansible/hosts
RUN pip install ansible

A similar approach is descriped in this post installing-and-building-docker-with-ansible

Calling local Ansible playbook and installing Packer

Github example

comments powered by Disqus