aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md49
-rwxr-xr-xcompare-image-size.sh21
2 files changed, 69 insertions, 1 deletions
diff --git a/README.md b/README.md
index 62d5119..e1e8401 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,36 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
42 - `williamyeh/ansible:centos6-onbuild` 42 - `williamyeh/ansible:centos6-onbuild`
43 43
44 44
45## For the impatient
46
47Here comes a simplest working example for the impatient.
48
49First, choose a base image you'd like to begin with. For example, `williamyeh/ansible:ubuntu14.04-onbuild`.
50
51Second, put the following `Dockerfile` along with your playbook directory:
52
53```
54FROM williamyeh/ansible:ubuntu14.04-onbuild
55
56# ==> Specify playbook filename; default = "playbook.yml"
57#ENV PLAYBOOK playbook.yml
58
59# ==> Specify inventory filename; default = "/etc/ansible/hosts"
60#ENV INVENTORY inventory.ini
61
62# ==> Executing Ansible...
63RUN ansible-playbook-wrapper
64```
65
66Third, `docker build .`
67
68Done!
69
70For more advanced usage, the role in Ansible Galaxy [`williamyeh/nginx`](https://github.com/William-Yeh/ansible-nginx) also demonstrates how to do a simple integration test on [Travis CI](https://travis-ci.org/).
71
72
73
74
45## Why yet another Ansible image for Docker? 75## Why yet another Ansible image for Docker?
46 76
47There has been quite a few Ansible images for Docker (e.g., [search](https://registry.hub.docker.com/search?q=ansible) in the Docker Hub), so why reinvent the wheel? 77There has been quite a few Ansible images for Docker (e.g., [search](https://registry.hub.docker.com/search?q=ansible) in the Docker Hub), so why reinvent the wheel?
@@ -55,11 +85,28 @@ In the beginning I used the [`ansible/ansible-docker-base`](https://github.com/a
55Therefore, I built these Docker images on my own. 85Therefore, I built these Docker images on my own.
56 86
57 87
88### Comparison: image size
89
90```
91REPOSITORY TAG VIRTUAL SIZE
92--------------------------- ------------------- ------------
93ansible/centos7-ansible stable 367.5 MB
94ansible/ubuntu14.04-ansible stable 286.6 MB
95
96williamyeh/ansible centos6-onbuild 264.2 MB
97williamyeh/ansible centos7-onbuild 275.3 MB
98williamyeh/ansible debian7-onbuild 134.4 MB
99williamyeh/ansible debian8-onbuild 178.3 MB
100williamyeh/ansible ubuntu12.04-onbuild 181.9 MB
101williamyeh/ansible ubuntu14.04-onbuild 238.3 MB
102```
103
104
58## Usage 105## Usage
59 106
60Used mostly as a *base image* for configuring, with Ansible, other software stack on some specified Linux distribution. 107Used mostly as a *base image* for configuring, with Ansible, other software stack on some specified Linux distribution.
61 108
62Take Debian/Ubuntu for example. To test an Ansible `playbook.yml` against a variety of Linux distributions, we may use [Vagrant](https://www.vagrantup.com/) as follows: 109Take Debian/Ubuntu/CentOS for example. To test an Ansible `playbook.yml` against a variety of Linux distributions, we may use [Vagrant](https://www.vagrantup.com/) as follows:
63 110
64```ruby 111```ruby
65# Vagrantfile 112# Vagrantfile
diff --git a/compare-image-size.sh b/compare-image-size.sh
new file mode 100755
index 0000000..9c7c5cd
--- /dev/null
+++ b/compare-image-size.sh
@@ -0,0 +1,21 @@
1#!/bin/bash
2
3
4declare -a IMAGES=( 'ansible/ubuntu14.04-ansible:stable' 'ansible/centos7-ansible:stable' \
5 "williamyeh/ansible:debian8-onbuild" \
6 "williamyeh/ansible:debian7-onbuild" \
7 "williamyeh/ansible:ubuntu14.04-onbuild" \
8 "williamyeh/ansible:ubuntu12.04-onbuild" \
9 "williamyeh/ansible:centos7-onbuild" \
10 "williamyeh/ansible:centos6-onbuild"
11 )
12
13for image in "${IMAGES[@]}" ; do
14
15 echo $image
16 docker pull $image
17
18done
19
20
21docker images | sort \ No newline at end of file