Create version specific ansible environment on docker ce w/Dockerfile
Objectives
- Personal memo
- Simple and fast
System
Instructions
1. Create Docker file
specify_version_at_last_line
FROM centos:7
RUN set -x && \
yum -y update && \
yum -y install git python-setuptools libffi-devel python-devel gcc python-crypto openssl-devel && \
easy_install pip && \
pip install paramiko PyYAML Jinja2 httplib2 six && \
pip install ansible==2.3.0.0
2. Build
sudo docker build -t ansible-2.3 .
(snip)
Successfully built ca8da6f11190
ubuntu@ubuntu-zesty:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ansible-2.3 latest ca8da6f11190 34 seconds ago 504 MB
3. Run
sudo docker run -i --name ansible-2.3_20170530 -t ansible-2.3 /bin/bash
[root@d5a53b5b28e6 /]# ansible --version
ansible 2.3.0.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]