SlideShare a Scribd company logo
1 of 13
Download to read offline
docker build 

with Ansible
Application construction
with Ansible
• vagrant, local mode
• packer, image creation
• cloud & bare metal provisioning
• deployment & remote execution
Application construction
with Dockerfile
• Dockerfile is the Docker way
• Each instruction creates a layer
• Lots of bash commands
• Maintainability? Testability?
• Portability?
Demo
• https://github.com/
bbaassssiiee/truedemo.git
tree
.  
|-­-­  Dockerfile  
|-­-­  Makefile  
|-­-­  ansible  
|      |-­-­  ansible.cfg  
|      |-­-­  hosts  
|      |-­-­  playbook.yml  
|      |-­-­  requirements.yml  
|      `-­-­  vars.yml  
`-­-­  webapps  
        `-­-­  gameoflife.war  
2  directories,  8  files
Dockerfile
FROM  centos:centos7  
MAINTAINER  Bas  Meijer  <bas.meijer@me.com>  
LABEL  running="docker  run  -­d  -­p  8080:8080  dockpack/tomcat:7"  
ADD  ansible  /tmp/ansible  
RUN  yum  update  -­y  &&    
        yum  install  -­y  epel-­release  &&    
        yum  install  -­y  ansible  tar  &&    
        yum  clean  all  &&    
        cd  /tmp/ansible  &&    
        ansible-­galaxy  install  -­-­force  -­r  requirements.yml  &&    
        ansible-­playbook  playbook.yml  
ADD  webapps  /opt/apache-­tomcat/webapps  
ENV  CATALINA_HOME  /opt/apache-­tomcat  
ENV  PATH  $CATALINA_HOME/bin:$PATH  
WORKDIR  $CATALINA_HOME  
EXPOSE  8080  
ENTRYPOINT  ["/opt/apache-­tomcat/bin/catalina.sh","run"]  
Makefile
AUTHOR=dockpack  
NAME=tomcat  
VERSION=7  
.PHONY:  all  build  bash  run  help  
all:  build  
build:  
   docker  build  -­t  $(AUTHOR)/$(NAME):$(VERSION)  .  
bash:  
   docker  exec  -­ti  dockpacktomcat  /bin/bash  
run:  
   docker  run  -­-­name  dockpacktomcat  -­h  dockpacktomcat  -­d  -­p  8080:8080  $
(AUTHOR)/$(NAME):$(VERSION)  
help:  
   @docker  inspect  $(AUTHOR)/$(NAME):$(VERSION)  |  grep  -­i  running  |  head  -­1  
test:  
   open  http://$(DOCKERHOST):8080/gameoflife/  
playbook.yml
-­-­-­  
-­  hosts:  docker  
    connection:  local  
    user:  root  
    gather_facts:  False  
    vars_files:  
        -­  vars.yml  
    roles:  
        -­  geerlingguy.java  
        -­  hudecof.tomcat  
docker build
docker  build  -­t  dockpack/tomcat:7  .  
Sending  build  context  to  Docker  daemon  6.578  MB  
Step  0  :  FROM  centos:centos7  
  -­-­-­>  ce20c473cd8a  
Step  1  :  MAINTAINER  Bas  Meijer  <bas.meijer@me.com>  
  -­-­-­>  Running  in  5e577b479ab4  
  -­-­-­>  836c1c700c00  
Removing  intermediate  container  5e577b479ab4  
Step  2  :  LABEL  running  "docker  run  -­d  -­p  8080:8080  dockpack/tomcat:7"  
  -­-­-­>  Running  in  56b9e596adc7  
  -­-­-­>  2b0f03a6e415  
Removing  intermediate  container  56b9e596adc7  
Step  3  :  ADD  ansible  /tmp/ansible  
  -­-­-­>  b282cb737950  
Removing  intermediate  container  b20ea1f41fef  
Step  4  :  RUN  yum  update  -­y  &&          yum  install  -­y  epel-­release  &&          
yum  install  -­y  ansible  tar  &&          yum  clean  all  &&          cd  /tmp/ansible  
&&          ansible-­galaxy  install  -­-­force  -­r  requirements.yml  &&          
ansible-­playbook  playbook.yml  
  -­-­-­>  Running  in  8ed5acb65b06  
docker build
  -­-­-­>  600eb11ee771  
Removing  intermediate  container  8ed5acb65b06  
Step  5  :  ADD  webapps  /opt/apache-­tomcat/webapps  
  -­-­-­>  4db505c0ad3a  
Removing  intermediate  container  9ef85479e13b  
Step  6  :  ENV  CATALINA_HOME  /opt/apache-­tomcat  
  -­-­-­>  Running  in  e0898552f75b  
  -­-­-­>  acd4777b6cff  
Removing  intermediate  container  e0898552f75b  
Step  7  :  ENV  PATH  $CATALINA_HOME/bin:$PATH  
  -­-­-­>  Running  in  cd95c5057ae6  
  -­-­-­>  3757a691866e  
Removing  intermediate  container  cd95c5057ae6  
Step  8  :  WORKDIR  $CATALINA_HOME  
  -­-­-­>  Running  in  10ffaf35619e  
  -­-­-­>  ffae6214c059  
Removing  intermediate  container  10ffaf35619e  
Step  9  :  EXPOSE  8080  
  -­-­-­>  Running  in  d728ed59907a  
  -­-­-­>  729cb0905aa4  
Removing  intermediate  container  d728ed59907a  
Step  10  :  ENTRYPOINT  /opt/apache-­tomcat/bin/catalina.sh  run  
  -­-­-­>  Running  in  d3014eaa2706  
  -­-­-­>  d73eddf84268  
Removing  intermediate  container  d3014eaa2706  
Successfully  built  d73eddf84268
ansible is 27 Mb
Installing:  
  ansible                                                            noarch    1.9.4-­1.el7                  epel        1.7  M  
Installing  for  dependencies:  
  PyYAML                                                              x86_64    3.10-­11.el7                  base        153  k  
  libyaml                                                            x86_64    0.1.4-­11.el7_0            base          55  k  
  python-­babel                                                  noarch    0.9.6-­8.el7                  base        1.4  M  
  python-­backports                                          x86_64    1.0-­8.el7                      base        5.8  k  
  python-­backports-­ssl_match_hostname    noarch    3.4.0.2-­4.el7              base          12  k  
  python-­crypto                                                x86_64    2.6.1-­1.el7.centos    extras    470  k  
  python-­ecdsa                                                  noarch    0.11-­3.el7.centos      extras      69  k  
  python-­httplib2                                            noarch    0.7.7-­3.el7                  epel          70  k  
  python-­jinja2                                                noarch    2.7.2-­2.el7                  base        515  k  
  python-­keyczar                                              noarch    0.71c-­2.el7                  epel        218  k  
  python-­markupsafe                                        x86_64    0.11-­10.el7                  base          25  k  
  python-­paramiko                                            noarch    1.15.1-­1.el7                epel        999  k  
  python-­pyasn1                                                noarch    0.1.6-­2.el7                  base          91  k  
  python-­setuptools                                        noarch    0.9.8-­3.el7                  base        396  k  
  python-­six                                                      noarch    1.3.0-­4.el7                  base          18  k  
  sshpass                                                            x86_64    1.05-­5.el7                    epel          21  k  
Transaction  Summary  
================================================================================  
Install    1  Package  (+16  Dependent  packages)  
Total  download  size:  6.1  M  
Installed  size:  27  M  
docker build with Ansible
• postpone decision how to run
• re-use app construction plays
• well-structured Ansible
• reduce number of layers
• little extra space
That`s all folks!

More Related Content

What's hot

Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with AnsibleAnas
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Keith Resar
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to AnsibleDan Vaida
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them AllTim Fairweather
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible referencelaonap166
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleKnoldus Inc.
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with AnsibleBas Meijer
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with AnsibleAhmed AbouZaid
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Richard Donkin
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleOmid Vahdaty
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginnersKuo-Le Mei
 

What's hot (20)

Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with Ansible
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginners
 

Viewers also liked

Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...Irakli Nadareishvili
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 

Viewers also liked (7)

Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Cyansible
CyansibleCyansible
Cyansible
 
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 

Similar to docker build with Ansible

Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by dockerWei-Ting Kuo
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 PresentationSreenivas Makam
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in descriptionPrzemyslaw Koltermann
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Ontico
 
AstriCon 2017 - Docker Swarm & Asterisk
AstriCon 2017  - Docker Swarm & AsteriskAstriCon 2017  - Docker Swarm & Asterisk
AstriCon 2017 - Docker Swarm & AsteriskEvan McGee
 
k8s practice 2023.pptx
k8s practice 2023.pptxk8s practice 2023.pptx
k8s practice 2023.pptxwonyong hwang
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...NLJUG
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Novaclayton_oneill
 
Docker for Java developers at JavaLand
Docker for Java developers at JavaLandDocker for Java developers at JavaLand
Docker for Java developers at JavaLandJohan Janssen
 
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes MeetupMetal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes MeetupLaure Vergeron
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Threestackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick ThreeNETWAYS
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session DockerLinetsChile
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by DockerTerry Chen
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDropsolid
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Dockernklmish
 
Añadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaAñadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaCésar Martín Ortiz Pintado
 

Similar to docker build with Ansible (20)

Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by docker
 
Docker as an every day work tool
Docker as an every day work toolDocker as an every day work tool
Docker as an every day work tool
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 
AstriCon 2017 - Docker Swarm & Asterisk
AstriCon 2017  - Docker Swarm & AsteriskAstriCon 2017  - Docker Swarm & Asterisk
AstriCon 2017 - Docker Swarm & Asterisk
 
OTRS
OTRSOTRS
OTRS
 
k8s practice 2023.pptx
k8s practice 2023.pptxk8s practice 2023.pptx
k8s practice 2023.pptx
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Nova
 
Docker for Java developers at JavaLand
Docker for Java developers at JavaLandDocker for Java developers at JavaLand
Docker for Java developers at JavaLand
 
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes MeetupMetal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Threestackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session Docker
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by Docker
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
 
Añadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaAñadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continua
 

Recently uploaded

A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Recently uploaded (20)

A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

docker build with Ansible

  • 2. Application construction with Ansible • vagrant, local mode • packer, image creation • cloud & bare metal provisioning • deployment & remote execution
  • 3. Application construction with Dockerfile • Dockerfile is the Docker way • Each instruction creates a layer • Lots of bash commands • Maintainability? Testability? • Portability?
  • 5. tree .   |-­-­  Dockerfile   |-­-­  Makefile   |-­-­  ansible   |      |-­-­  ansible.cfg   |      |-­-­  hosts   |      |-­-­  playbook.yml   |      |-­-­  requirements.yml   |      `-­-­  vars.yml   `-­-­  webapps          `-­-­  gameoflife.war   2  directories,  8  files
  • 6. Dockerfile FROM  centos:centos7   MAINTAINER  Bas  Meijer  <bas.meijer@me.com>   LABEL  running="docker  run  -­d  -­p  8080:8080  dockpack/tomcat:7"   ADD  ansible  /tmp/ansible   RUN  yum  update  -­y  &&            yum  install  -­y  epel-­release  &&            yum  install  -­y  ansible  tar  &&            yum  clean  all  &&            cd  /tmp/ansible  &&            ansible-­galaxy  install  -­-­force  -­r  requirements.yml  &&            ansible-­playbook  playbook.yml   ADD  webapps  /opt/apache-­tomcat/webapps   ENV  CATALINA_HOME  /opt/apache-­tomcat   ENV  PATH  $CATALINA_HOME/bin:$PATH   WORKDIR  $CATALINA_HOME   EXPOSE  8080   ENTRYPOINT  ["/opt/apache-­tomcat/bin/catalina.sh","run"]  
  • 7. Makefile AUTHOR=dockpack   NAME=tomcat   VERSION=7   .PHONY:  all  build  bash  run  help   all:  build   build:     docker  build  -­t  $(AUTHOR)/$(NAME):$(VERSION)  .   bash:     docker  exec  -­ti  dockpacktomcat  /bin/bash   run:     docker  run  -­-­name  dockpacktomcat  -­h  dockpacktomcat  -­d  -­p  8080:8080  $ (AUTHOR)/$(NAME):$(VERSION)   help:     @docker  inspect  $(AUTHOR)/$(NAME):$(VERSION)  |  grep  -­i  running  |  head  -­1   test:     open  http://$(DOCKERHOST):8080/gameoflife/  
  • 8. playbook.yml -­-­-­   -­  hosts:  docker      connection:  local      user:  root      gather_facts:  False      vars_files:          -­  vars.yml      roles:          -­  geerlingguy.java          -­  hudecof.tomcat  
  • 9. docker build docker  build  -­t  dockpack/tomcat:7  .   Sending  build  context  to  Docker  daemon  6.578  MB   Step  0  :  FROM  centos:centos7    -­-­-­>  ce20c473cd8a   Step  1  :  MAINTAINER  Bas  Meijer  <bas.meijer@me.com>    -­-­-­>  Running  in  5e577b479ab4    -­-­-­>  836c1c700c00   Removing  intermediate  container  5e577b479ab4   Step  2  :  LABEL  running  "docker  run  -­d  -­p  8080:8080  dockpack/tomcat:7"    -­-­-­>  Running  in  56b9e596adc7    -­-­-­>  2b0f03a6e415   Removing  intermediate  container  56b9e596adc7   Step  3  :  ADD  ansible  /tmp/ansible    -­-­-­>  b282cb737950   Removing  intermediate  container  b20ea1f41fef   Step  4  :  RUN  yum  update  -­y  &&          yum  install  -­y  epel-­release  &&           yum  install  -­y  ansible  tar  &&          yum  clean  all  &&          cd  /tmp/ansible   &&          ansible-­galaxy  install  -­-­force  -­r  requirements.yml  &&           ansible-­playbook  playbook.yml    -­-­-­>  Running  in  8ed5acb65b06  
  • 10. docker build  -­-­-­>  600eb11ee771   Removing  intermediate  container  8ed5acb65b06   Step  5  :  ADD  webapps  /opt/apache-­tomcat/webapps    -­-­-­>  4db505c0ad3a   Removing  intermediate  container  9ef85479e13b   Step  6  :  ENV  CATALINA_HOME  /opt/apache-­tomcat    -­-­-­>  Running  in  e0898552f75b    -­-­-­>  acd4777b6cff   Removing  intermediate  container  e0898552f75b   Step  7  :  ENV  PATH  $CATALINA_HOME/bin:$PATH    -­-­-­>  Running  in  cd95c5057ae6    -­-­-­>  3757a691866e   Removing  intermediate  container  cd95c5057ae6   Step  8  :  WORKDIR  $CATALINA_HOME    -­-­-­>  Running  in  10ffaf35619e    -­-­-­>  ffae6214c059   Removing  intermediate  container  10ffaf35619e   Step  9  :  EXPOSE  8080    -­-­-­>  Running  in  d728ed59907a    -­-­-­>  729cb0905aa4   Removing  intermediate  container  d728ed59907a   Step  10  :  ENTRYPOINT  /opt/apache-­tomcat/bin/catalina.sh  run    -­-­-­>  Running  in  d3014eaa2706    -­-­-­>  d73eddf84268   Removing  intermediate  container  d3014eaa2706   Successfully  built  d73eddf84268
  • 11. ansible is 27 Mb Installing:    ansible                                                            noarch    1.9.4-­1.el7                  epel        1.7  M   Installing  for  dependencies:    PyYAML                                                              x86_64    3.10-­11.el7                  base        153  k    libyaml                                                            x86_64    0.1.4-­11.el7_0            base          55  k    python-­babel                                                  noarch    0.9.6-­8.el7                  base        1.4  M    python-­backports                                          x86_64    1.0-­8.el7                      base        5.8  k    python-­backports-­ssl_match_hostname    noarch    3.4.0.2-­4.el7              base          12  k    python-­crypto                                                x86_64    2.6.1-­1.el7.centos    extras    470  k    python-­ecdsa                                                  noarch    0.11-­3.el7.centos      extras      69  k    python-­httplib2                                            noarch    0.7.7-­3.el7                  epel          70  k    python-­jinja2                                                noarch    2.7.2-­2.el7                  base        515  k    python-­keyczar                                              noarch    0.71c-­2.el7                  epel        218  k    python-­markupsafe                                        x86_64    0.11-­10.el7                  base          25  k    python-­paramiko                                            noarch    1.15.1-­1.el7                epel        999  k    python-­pyasn1                                                noarch    0.1.6-­2.el7                  base          91  k    python-­setuptools                                        noarch    0.9.8-­3.el7                  base        396  k    python-­six                                                      noarch    1.3.0-­4.el7                  base          18  k    sshpass                                                            x86_64    1.05-­5.el7                    epel          21  k   Transaction  Summary   ================================================================================   Install    1  Package  (+16  Dependent  packages)   Total  download  size:  6.1  M   Installed  size:  27  M  
  • 12. docker build with Ansible • postpone decision how to run • re-use app construction plays • well-structured Ansible • reduce number of layers • little extra space