SlideShare a Scribd company logo
HELLO WORLD! 
Toshio Kuratomi 
Worked for Red Hat on the Fedora Infrastructure Team 
Little bit of sysadmin work 
Gobs of Python
FUN WITH CONTAINERS 
and 
Toshio Kuratomi
WHAT IS DOCKER? 
Manages Linux containers 
Allows deploying applications in isolation 
Docker Hub ecosystem for distributing general containers
IMAGES 
Made of layers 
Base Images basically OS installs 
Immutable 
Customize by creating a new layer on top
WHAT CAN I DO WITH IT? 
Lightweight cloud 
Tool for encapsulating applications
LIGHTWEIGHT CLOUD 
Lower runtime overhead 
Layered filesystem 
Very quick startup time
ENCAPSULATED APPLICATIONS 
Low overhead 
Run application on startup 
Similar to init
GREAT! SO WHAT'S ANSIBLE GOT TO DO WITH IT?
BUILDING AN IMAGE (DOCKERFILE) 
FROM centos:stable 
RUN yum -y upgrade 
RUN yum install httpd 
COPY httpd.conf /etc/httpd/conf/httpd.conf 
EXPOSE 80 
ENTRYPOINT ["/usr/sbin/apachectl", "-DFOREGOUND"]
BUILDING AN IMAGE (WITH ANSIBLE) 
FROM ansible/centos7-ansible:stable 
ADD ansible /srv/example/ 
WORKDIR /srv/example 
RUN ansible-playbook site.yml -c local 
EXPOSE 80 
ENTRYPOINT ["/usr/sbin/apachectl", "-DFOREGROUND"]
BUILDING AN IMAGE (WITH ANSIBLE) 
ansible/site.yml: 
- hosts: localhost 
tasks: 
- yum: pkg=httpd state=present 
- copy: 
src: httpd.conf 
dest: /etc/httpd/conf/httpd.conf 
group: "apache" 
mode: "0644"
HUH. SO WHAT MAKES ANSIBLE BETTER? 
Power and consistency 
Same method to configure images as your hosts 
Templates and Conditionals 
Portability 
Try out new things via Galaxy roles
A MORE COMPLEX EXAMPLE! 
- hosts: localhost 
vars: 
apache_group: 
Debian: "root" 
RedHat: "apache" 
apache_ctl: 
Debian: "/usr/sbin/apache2ctl" 
RedHat: "/usr/sbin/apachectl"
A MORE COMPLEX EXAMPLE! 
tasks: 
- yum: pkg=httpd state=present 
when: ansible_os_family == "RedHat" 
- apt: update_cache=yes name="apache2" state=present 
when: ansible_os_family == "Debian" 
- name: Make an apachectl symlink that is the same between distros 
file: 
state: link 
src: "{{apache_ctl[ansible_os_family]}}" 
dest: /usr/local/bin/apachectl
A MORE COMPLEX EXAMPLE! 
- name: Apply httpd configuration from template 
template: 
src: httpd.conf.j2 
dest: /etc/httpd/conf/httpd.conf 
group: "{{ apache_group[ansible_os_family] }}" 
mode: "0644"
GALAXY + DOCKER == TRY BEFORE YOU BUY 
FROM ansible/ubuntu14.04-ansible:stable 
RUN mkdir /srv/example 
WORKDIR /srv/example 
ADD site.yml /srv/example/ 
RUN ansible-galaxy install geerlingguy.memcached 
RUN ansible-playbook site.yml -c local 
EXPOSE 11211 
ENTRYPOINT ["/usr/bin/memcached", "-u", "memcache", "-l", "0.0.0.0", "-c" "1024", "-p",
GALAXY + DOCKER == TRY BEFORE YOU BUY 
- hosts: localhost 
roles: 
- role: geerlingguy.memcached
IMAGES FOR BUILDING 
Ansible layered on a Base OS Image 
Building four images 
Two images for Ubuntu-14.04 
Two images for CentOS-7 
An image for Ansible HEAD 
An image for the Ansible release on pypi
CONTACT INFO & RESOURCES 
https://registry.hub.docker.com/u/ansible/centos7-ansible/ 
https://registry.hub.docker.com/u/ansible/ubuntu14.04-ansible/ 
http://ansible.github.com/ansible/ansible-docker-base 
http://ansible.com 
tkuratomi@ansible.com

More Related Content

PDF
Docker orchestration using core os and ansible - Ansible IL 2015
PDF
Ansible Oxford - Cows & Containers
PDF
이미지 기반의 배포 패러다임 Immutable infrastructure
PDF
Docker puppetcamp london 2013
PDF
Docker up and running
PDF
CoreOS : 설치부터 컨테이너 배포까지
PDF
Amazon EC2 Container Service in Action
PDF
Running Django on Docker: a workflow and code
Docker orchestration using core os and ansible - Ansible IL 2015
Ansible Oxford - Cows & Containers
이미지 기반의 배포 패러다임 Immutable infrastructure
Docker puppetcamp london 2013
Docker up and running
CoreOS : 설치부터 컨테이너 배포까지
Amazon EC2 Container Service in Action
Running Django on Docker: a workflow and code

What's hot (20)

PDF
Infrastructure Deployment with Docker & Ansible
PDF
Hands-On Session Docker
PDF
Automatic docker service announcement with registrator and confd
PDF
Deploying PHP Applications with Ansible
PDF
Very Early Review - Rocket(CoreOS)
PDF
Continuous integration with Docker and Ansible
PPTX
Cyansible
PDF
Kubernetes Boston — Custom High Availability of Kubernetes
PDF
Launching containers with fleet
PPTX
Ansible presentation
PDF
Introducing Ansible
PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
PDF
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
PDF
Ansible - Swiss Army Knife Orchestration
ODP
Fabric: A Capistrano Alternative
PDF
Managing Your Cisco Datacenter Network with Ansible
PDF
Docker use dockerfile
PPT
Hadoop on ec2
PDF
Docker for mere mortals
PDF
Quay 3.3 installation
Infrastructure Deployment with Docker & Ansible
Hands-On Session Docker
Automatic docker service announcement with registrator and confd
Deploying PHP Applications with Ansible
Very Early Review - Rocket(CoreOS)
Continuous integration with Docker and Ansible
Cyansible
Kubernetes Boston — Custom High Availability of Kubernetes
Launching containers with fleet
Ansible presentation
Introducing Ansible
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Ansible - Swiss Army Knife Orchestration
Fabric: A Capistrano Alternative
Managing Your Cisco Datacenter Network with Ansible
Docker use dockerfile
Hadoop on ec2
Docker for mere mortals
Quay 3.3 installation
Ad

Viewers also liked (18)

PPTX
Docker Meetup Paris: enterprise Docker
PDF
Docker Build
PPTX
How bigtop leveraged docker for build automation and one click hadoop provis...
PPTX
Docker - Build, Ship and Run Any App, Anywhere Hollywood edition
PPTX
Docker on AWS - the Right Way
PDF
Spark Summit Europe 2016 Keynote - Databricks CEO
PDF
GDGSCL - Docker a jeho provoz v Heroku a AWS
PDF
Spark Summit EU 2016 Keynote - Simplifying Big Data in Apache Spark 2.0
PPTX
August 2016 HUG: Open Source Big Data Ingest with StreamSets Data Collector
PDF
Docker Hub Breakout Session at DockerCon by Ken Cochrane
PPTX
Parallelizing Existing R Packages with SparkR
PPTX
A new model for Docker image distribution
ODP
Modelo de carta formal e informal com exemplos
PDF
Kubernetes Meetup Paris #5 - Metriques applicatives k8s
PPTX
Introducing apache prediction io (incubating) (bay area spark meetup at sales...
PPTX
TensorFrames: Google Tensorflow on Apache Spark
PPTX
Docker Hub: Past, Present and Future by Ken Cochrane & BC Wong
PPTX
Docker 101 - Nov 2016
Docker Meetup Paris: enterprise Docker
Docker Build
How bigtop leveraged docker for build automation and one click hadoop provis...
Docker - Build, Ship and Run Any App, Anywhere Hollywood edition
Docker on AWS - the Right Way
Spark Summit Europe 2016 Keynote - Databricks CEO
GDGSCL - Docker a jeho provoz v Heroku a AWS
Spark Summit EU 2016 Keynote - Simplifying Big Data in Apache Spark 2.0
August 2016 HUG: Open Source Big Data Ingest with StreamSets Data Collector
Docker Hub Breakout Session at DockerCon by Ken Cochrane
Parallelizing Existing R Packages with SparkR
A new model for Docker image distribution
Modelo de carta formal e informal com exemplos
Kubernetes Meetup Paris #5 - Metriques applicatives k8s
Introducing apache prediction io (incubating) (bay area spark meetup at sales...
TensorFrames: Google Tensorflow on Apache Spark
Docker Hub: Past, Present and Future by Ken Cochrane & BC Wong
Docker 101 - Nov 2016
Ad

Similar to Fun with containers: Use Ansible to build Docker images (20)

PDF
Docker for developers on mac and windows
PDF
Agile Brown Bag - Vagrant & Docker: Introduction
PPTX
Introduction to Docker
PDF
Ansible new paradigms for orchestration
PPTX
Docker Starter Pack
PPTX
Dockerizing a Symfony2 application
PDF
Docker in Action
PDF
Docker perl build
PDF
Shipping Applications to Production in Containers with Docker
PDF
Docker Tips And Tricks at the Docker Beijing Meetup
PPTX
PDF
CoreOS, or How I Learned to Stop Worrying and Love Systemd
PPTX
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
PDF
Preparation study of_docker - (MOSG)
PDF
Introduction to Docker and deployment and Azure
PPTX
Docker Ecosystem on Azure
PDF
Docker Online Meetup #3: Docker in Production
PPTX
Docker
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
PDF
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
Docker for developers on mac and windows
Agile Brown Bag - Vagrant & Docker: Introduction
Introduction to Docker
Ansible new paradigms for orchestration
Docker Starter Pack
Dockerizing a Symfony2 application
Docker in Action
Docker perl build
Shipping Applications to Production in Containers with Docker
Docker Tips And Tricks at the Docker Beijing Meetup
CoreOS, or How I Learned to Stop Worrying and Love Systemd
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Preparation study of_docker - (MOSG)
Introduction to Docker and deployment and Azure
Docker Ecosystem on Azure
Docker Online Meetup #3: Docker in Production
Docker
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Encapsulation theory and applications.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
Tartificialntelligence_presentation.pptx
Big Data Technologies - Introduction.pptx
A comparative analysis of optical character recognition models for extracting...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Encapsulation theory and applications.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
gpt5_lecture_notes_comprehensive_20250812015547.pdf

Fun with containers: Use Ansible to build Docker images

  • 1. HELLO WORLD! Toshio Kuratomi Worked for Red Hat on the Fedora Infrastructure Team Little bit of sysadmin work Gobs of Python
  • 2. FUN WITH CONTAINERS and Toshio Kuratomi
  • 3. WHAT IS DOCKER? Manages Linux containers Allows deploying applications in isolation Docker Hub ecosystem for distributing general containers
  • 4. IMAGES Made of layers Base Images basically OS installs Immutable Customize by creating a new layer on top
  • 5. WHAT CAN I DO WITH IT? Lightweight cloud Tool for encapsulating applications
  • 6. LIGHTWEIGHT CLOUD Lower runtime overhead Layered filesystem Very quick startup time
  • 7. ENCAPSULATED APPLICATIONS Low overhead Run application on startup Similar to init
  • 8. GREAT! SO WHAT'S ANSIBLE GOT TO DO WITH IT?
  • 9. BUILDING AN IMAGE (DOCKERFILE) FROM centos:stable RUN yum -y upgrade RUN yum install httpd COPY httpd.conf /etc/httpd/conf/httpd.conf EXPOSE 80 ENTRYPOINT ["/usr/sbin/apachectl", "-DFOREGOUND"]
  • 10. BUILDING AN IMAGE (WITH ANSIBLE) FROM ansible/centos7-ansible:stable ADD ansible /srv/example/ WORKDIR /srv/example RUN ansible-playbook site.yml -c local EXPOSE 80 ENTRYPOINT ["/usr/sbin/apachectl", "-DFOREGROUND"]
  • 11. BUILDING AN IMAGE (WITH ANSIBLE) ansible/site.yml: - hosts: localhost tasks: - yum: pkg=httpd state=present - copy: src: httpd.conf dest: /etc/httpd/conf/httpd.conf group: "apache" mode: "0644"
  • 12. HUH. SO WHAT MAKES ANSIBLE BETTER? Power and consistency Same method to configure images as your hosts Templates and Conditionals Portability Try out new things via Galaxy roles
  • 13. A MORE COMPLEX EXAMPLE! - hosts: localhost vars: apache_group: Debian: "root" RedHat: "apache" apache_ctl: Debian: "/usr/sbin/apache2ctl" RedHat: "/usr/sbin/apachectl"
  • 14. A MORE COMPLEX EXAMPLE! tasks: - yum: pkg=httpd state=present when: ansible_os_family == "RedHat" - apt: update_cache=yes name="apache2" state=present when: ansible_os_family == "Debian" - name: Make an apachectl symlink that is the same between distros file: state: link src: "{{apache_ctl[ansible_os_family]}}" dest: /usr/local/bin/apachectl
  • 15. A MORE COMPLEX EXAMPLE! - name: Apply httpd configuration from template template: src: httpd.conf.j2 dest: /etc/httpd/conf/httpd.conf group: "{{ apache_group[ansible_os_family] }}" mode: "0644"
  • 16. GALAXY + DOCKER == TRY BEFORE YOU BUY FROM ansible/ubuntu14.04-ansible:stable RUN mkdir /srv/example WORKDIR /srv/example ADD site.yml /srv/example/ RUN ansible-galaxy install geerlingguy.memcached RUN ansible-playbook site.yml -c local EXPOSE 11211 ENTRYPOINT ["/usr/bin/memcached", "-u", "memcache", "-l", "0.0.0.0", "-c" "1024", "-p",
  • 17. GALAXY + DOCKER == TRY BEFORE YOU BUY - hosts: localhost roles: - role: geerlingguy.memcached
  • 18. IMAGES FOR BUILDING Ansible layered on a Base OS Image Building four images Two images for Ubuntu-14.04 Two images for CentOS-7 An image for Ansible HEAD An image for the Ansible release on pypi
  • 19. CONTACT INFO & RESOURCES https://registry.hub.docker.com/u/ansible/centos7-ansible/ https://registry.hub.docker.com/u/ansible/ubuntu14.04-ansible/ http://ansible.github.com/ansible/ansible-docker-base http://ansible.com tkuratomi@ansible.com