SlideShare a Scribd company logo
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Docker and Ansible
Container management made easy
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
About the speaker
● Patrick Galbraith
● HP Advanced Technology Group
● Has worked at Blue Gecko, MySQL AB, Classmates,
Slashdot, Cobalt Group, US Navy, K-mart
● MySQL projects: memcached UDFs, DBD::mysql,
federated storage engine
● Family
● Outdoors
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted3
What is a container?
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted4
Containers vs. VMs
Containers
● Multiple isolated userspace instances
● Only libraries and components needed
for application
● Runs on the same kernel (using
Cgroups).
● Much smaller, easier to package
● VERY fast to start!
● Container runs using (a) specific
process(es)
● SSH not needed
● Security limited to app
VMs
● Entire OS installation
● Container runs within OS (using
Cgroups).
● VM runs using emulation or
virtualization on host OS
● Entire VM OS and disk images
● Longer to start
● SSH
● Security issues of running OS
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted5
What is Docker?
● Application that manages containers (CLI, API)
● Automates the deployment of applications inside software containers
● Written in Go, Opensource dotCloud
● Uses union file system (AUFS)
● Can use CLI to search Docker repos for images
● "literally LXC with some awesomesauce on top”
● No “dependency hell”
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted6
Why Docker?
● Makes it very easy to run and manage containers
● Configure/build once, run anywhere
● Small footprint in terms of disk and memory
● Well-suited for SaaS/PaaS
● Security - you are not running a VM and associated
OS
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted7
Docker concepts
● Images
● Read only layer
● Acts as a template for containers
● Inheritance
● images can be pushed to and pulled from public
or private repos
● Dockerfile
● Used for building images
● Containers
● Applications run using containers
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted8
Dockerfile example
FROM ubuntu:13.04
MAINTAINER Patrick aka CaptTofu Galbraith , patg@patg.net
# Update distribution
RUN apt-get update 
&& apt-get upgrade -y 
&& apt-get clean
RUN apt-get install -y ssh vim apache2-mpm-prefork
RUN mkdir /var/run/sshd
RUN mkdir /root/.ssh
RUN chmod 700 /root/.ssh
# entrypoint script
ADD entrypoint.sh /usr/local/sbin/entrypoint.sh
ADD docker.pem.pub /root/.ssh/authorized_keys
RUN chown -R root:root /root/.ssh
# Expose SSH and Apache
EXPOSE 22 80 443
ENTRYPOINT ["/usr/local/sbin/entrypoint.sh"]
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted9
Entrypoint script example
#!/bin/bash
/usr/sbin/sshd -D $@
service apache2 start
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted10
Docker concepts
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted11
Basic usage
● docker run
● Make changes
● docker commit
● docker push
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted12
Dockerfile
● docker build –t username/my_image
● Container runs
● Each step results in an a commit (image being
created)
● CMD vs. ENTRYPOINT
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted13
Ansible + Docker
● docker module
● docker_images module
● docker_facts module
● Docker inventory plugin
● Uses docker-py Docker client python library
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted14
What we used
● HP Moonshot
● New server – low power (1500W x2 min)
● Small footprint
● Designed for targeted workloads
● One 4.3 U container chassis
● 45 cartridges
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted15
Install Docker
$ ansible-galaxy install angstwad.docker_ubuntu
- hosts:local
connection: local
roles:
- angstwad.docker_ubuntu
DOCKER_OPTS="--ip=0.0.0.0 --host=tcp://0.0.0.0:4243”
Example: install docker install role
Example: add options to template deployed to /etc/defaults/docker
Example: playbook to install using docker install role
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted16
Install Docker
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted17
Install Docker
Example: running ansible to verify that Docker is installed on containers
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted18
docker_images module
● Builds Docker images
● Simple: add, build or remove
- name: check or build percona XtraDB Cluster image
docker_image: docker_url=“tcp://127.0.0.1:4243”
path=”../docker-image-source/pxc/"
name=”capttofu/pxc" state=present
Example: playbook to build a Percona XtraDB Cluster
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted19
docker_images module
Example: build several images using playbook using docker_images
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted20
docker_images module
Example: Display of newly built images
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted21
docker module
● Container provisioning – start, stop, delete containers
● Set parameters on a container
Example: Playbook that builds Percona XtraDB Cluster
image- name: docker image control
local_action:
module: docker
docker_url: "tcp://somehost:4243"
image: ”capttofu/percona_xtradb"
name: ”db"
state: ”present"
publish_all_ports: yes
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted22
docker module
$ ansible-playbook site.yml -e 'hosts=moonshot'
$ ansible-playbook site.yml -e 'hosts=moonshot docker_state=absent'
Example: Docker container control
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted23
docker module
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted24
docker module
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted25
docker_facts module
● Populate large dictionary docker_facts containing
information about Docker container fleet and images
● Two primary dictionary entries: docker_containers
and docker_images
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted26
docker_facts module
- name: Gather info about containers
hosts: "{{ hosts }}"
gather_facts: False
tasks:
- name: Get facts about containers
local_action:
docker_url: tcp://{{ inventory_hostname }}:4243
module: docker_facts
- name: another facts test
debug: msg="Host{{':'}} {{ inventory_hostname}} Container Name{{':'}} {{ item.key }}
IP Address{{':'}} {{ item.value.docker_networksettings.IPAddress }}
ssh port{{':'}} {{ item.value['docker_networksettings']['Ports']['22/tcp'][0]['HostPort'] }}
with_dict: docker_containers
Example: print out container fleet info
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted27
docker_facts module
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted28
docker_facts module
- name: Gather info about
containers
hosts: docker
gather_facts: True
tasks:
- name: Get facts about
containers
local_action:
module: docker_facts
name: db_1
images: aff77f73ca3d
Example: print out specific container or images
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted29
docker_facts module
- name: Gather info about containers
hosts: "{{ hosts }}"
gather_facts: True
tasks:
- name: Get facts about containers
local_action:
docker_url: tcp://{{ inventory_hostname }}:4243
module: docker_facts
images: all
- name: images info
debug: msg="Image ID {{ item.key }} Repo Tags {{
item.value.docker_repotags }}"
with_dict: docker_images
Example: Print out all images
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted30
docker_facts module
---
- name: Create an invetory file
hosts: moonshot
gather_facts: yes
tasks:
- name: Get facts about containers
local_action:
docker_url: tcp://{{ inventory_hostname }}:4243
module: docker_facts
- name: docker_hosts template
local_action: template src=docker_hosts.txt.j2 dest=./docker_hosts_{{ inventory_hostname }}.txt
Example: Use docker_facts to print out inventory file
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted31
docker_facts module
[c10n1.atg.seattle.lan]
c19n1_db_1 ansible_ssh_port=49270 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_db_2 ansible_ssh_port=49275 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_db_3 ansible_ssh_port=49280 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_haproxy_1 ansible_ssh_port=49285 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_haproxy_2 ansible_ssh_port=49287 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_haproxy_3 ansible_ssh_port=49289 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_haproxy_4 ansible_ssh_port=49291 ansible_ssh_host=c10n1.atg.seattle.lan
c19n1_web_1 ansible_ssh_port=49240 ansible_ssh_host=c10n1.atg.seattle.lan
...
{% for host in hostvars | sort %}
[{{ host }}]
{% for container in docker_containers | sort %}
{{ container }} ansible_ssh_port={{ docker_containers[container]['docker_networksettings']['Ports']['22/tcp'][0
ansible_ssh_host={{ host }}
{% endfor %}
{% endfor %}
The produced file:
Jinja template:
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted32
Docker Dynamic inventory
● Ability to manage elastic resources
● Plugins provide a JSON output that serves as an
inventory list to use
● ansible –i plugin playbook.yml
● ansible –i docker.py main.yml
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted33
Dynamic inventory
---
- name: Create a docker.yml file
hosts: moonshot
gather_facts: yes
tasks:
- name: docker.yml template
local_action: template src=docker.yml.j2 dest=./docker.yml
Example: Playbook to create a dynamic inventory config file
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted34
Dynamic inventory
---
defaults:
host: unix:///var/run/docker.sock
version: 1.9
timeout: 60
private_ssh_port: 22
default_ip: 127.0.0.1
hosts:
{% for key in hostvars %}
- host: tcp://{{ key }}:4243
version: 1.9
timeout: 60
default_ip: {{
hostvars[key]['ansible_default_ipv4']['address'] }}
{% endfor %}
Example: Jinja template for docker inventory plugin config file
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted35
Dynamic inventory
hosts:
- host: tcp://c29n1.atg.seattle.lan:4243
version: 1.9
timeout: 60
default_ip: 10.99.33.38
- host: tcp://c15n1.atg.seattle.lan:4243
version: 1.9
timeout: 60
default_ip: 10.99.33.24
- host: tcp://c14n1.atg.seattle.lan:4243
version: 1.9
timeout: 60
default_ip: 10.99.33.23
…
Example: Produced docker inventory plugin config
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted36
Dynamic inventory
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted37
Cleanup
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted38
Acknowledgements
• Paul Durivage (https://github.com/angstwad)
• Yazz Atlas (https://twitter.com/EntropyWorks)
• Brian Aker (https://en.wikipedia.org/wiki/Brian_Aker, @brianaker, IRC krow)
• Michael DeHaan (https://twitter.com/laserllama)
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted39
Resources
• http://patg.net
• https://galaxy.ansible.com/list#/users/1488
• http://docker.io
• https://github.com/CaptTofu/ansible-docker-presentation
• https://github.com/CaptTofu/docker-image-source
• http://www.slideshare.net/PatrickGalbraith/docker-ansible-34909080
• http://blog.docker.io/2013/06/openstack-docker-manage-linux-containers-
with-nova/
• https://index.docker.io/u/ewindisch/dockenstack/

More Related Content

What's hot

Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
Chris Tankersley
 
Galera on kubernetes_no_video
Galera on kubernetes_no_videoGalera on kubernetes_no_video
Galera on kubernetes_no_video
Patrick Galbraith
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
NGINX, Inc.
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Open
 
Intro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and WindowsIntro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and Windows
Thomas Chacko
 
Docker - introduction
Docker - introductionDocker - introduction
Docker - introduction
Michał Kurzeja
 
Build a PaaS with OpenShift Origin
Build a PaaS with OpenShift OriginBuild a PaaS with OpenShift Origin
Build a PaaS with OpenShift Origin
Steven Pousty
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
Chris Tankersley
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
Docker, Inc.
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
Ben Hall
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
dotCloud
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based Deployments
Ben Hall
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
Mathieu Buffenoir
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and Docker
Bob Killen
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
Giacomo Vacca
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Adam Štipák
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
Michał Kurzeja
 
ContainerDayVietnam2016: Django Development with Docker
ContainerDayVietnam2016: Django Development with DockerContainerDayVietnam2016: Django Development with Docker
ContainerDayVietnam2016: Django Development with Docker
Docker-Hanoi
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a container
Johan Janssen
 
Core os dna_automacon
Core os dna_automaconCore os dna_automacon
Core os dna_automacon
Patrick Galbraith
 

What's hot (20)

Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
Galera on kubernetes_no_video
Galera on kubernetes_no_videoGalera on kubernetes_no_video
Galera on kubernetes_no_video
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
 
Intro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and WindowsIntro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and Windows
 
Docker - introduction
Docker - introductionDocker - introduction
Docker - introduction
 
Build a PaaS with OpenShift Origin
Build a PaaS with OpenShift OriginBuild a PaaS with OpenShift Origin
Build a PaaS with OpenShift Origin
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based Deployments
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and Docker
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
ContainerDayVietnam2016: Django Development with Docker
ContainerDayVietnam2016: Django Development with DockerContainerDayVietnam2016: Django Development with Docker
ContainerDayVietnam2016: Django Development with Docker
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a container
 
Core os dna_automacon
Core os dna_automaconCore os dna_automacon
Core os dna_automacon
 

Viewers also liked

A Dive Into Containers and Docker
A Dive Into Containers and DockerA Dive Into Containers and Docker
A Dive Into Containers and Docker
Matthew Farina
 
Core os dna_oscon
Core os dna_osconCore os dna_oscon
Core os dna_oscon
Patrick Galbraith
 
CoreOS automated MySQL Cluster Failover using Galera Cluster
CoreOS automated MySQL Cluster Failover using Galera ClusterCoreOS automated MySQL Cluster Failover using Galera Cluster
CoreOS automated MySQL Cluster Failover using Galera Cluster
Yazz Atlas
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
 
Ansibleで味わうHelion OpenStack
Ansibleで味わうHelion OpenStackAnsibleで味わうHelion OpenStack
Ansibleで味わうHelion OpenStack
Masataka Tsukamoto
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
bcoca
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Ansible
AnsibleAnsible
Ansible & Vagrant
Ansible & VagrantAnsible & Vagrant
Ansible & Vagrant
Mukul Malhotra
 
Managing sensitive data with Ansible vault
Managing sensitive data with Ansible vaultManaging sensitive data with Ansible vault
Managing sensitive data with Ansible vault
Pascal Stauffer
 
Flexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-AnsibleFlexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-Ansible
Major Hayden
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
bcoca
 
Ansible for Enterprise
Ansible for EnterpriseAnsible for Enterprise
Ansible for Enterprise
Ansible
 
[세미나] Vagrant 이지원
[세미나] Vagrant 이지원[세미나] Vagrant 이지원
[세미나] Vagrant 이지원지원 이
 
OpenStack-Ansible Security
OpenStack-Ansible SecurityOpenStack-Ansible Security
OpenStack-Ansible Security
Major Hayden
 
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
승엽 신
 
Building distribution packages with Docker
Building distribution packages with DockerBuilding distribution packages with Docker
Building distribution packages with Docker
Bruno Cornec
 
Design Portfolio
Design PortfolioDesign Portfolio
Design Portfolio
Colorcode Global
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Mukul Malhotra
 
Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화
AWSKRUG - AWS한국사용자모임
 

Viewers also liked (20)

A Dive Into Containers and Docker
A Dive Into Containers and DockerA Dive Into Containers and Docker
A Dive Into Containers and Docker
 
Core os dna_oscon
Core os dna_osconCore os dna_oscon
Core os dna_oscon
 
CoreOS automated MySQL Cluster Failover using Galera Cluster
CoreOS automated MySQL Cluster Failover using Galera ClusterCoreOS automated MySQL Cluster Failover using Galera Cluster
CoreOS automated MySQL Cluster Failover using Galera Cluster
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Ansibleで味わうHelion OpenStack
Ansibleで味わうHelion OpenStackAnsibleで味わうHelion OpenStack
Ansibleで味わうHelion OpenStack
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Ansible & Vagrant
Ansible & VagrantAnsible & Vagrant
Ansible & Vagrant
 
Managing sensitive data with Ansible vault
Managing sensitive data with Ansible vaultManaging sensitive data with Ansible vault
Managing sensitive data with Ansible vault
 
Flexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-AnsibleFlexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-Ansible
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
Ansible for Enterprise
Ansible for EnterpriseAnsible for Enterprise
Ansible for Enterprise
 
[세미나] Vagrant 이지원
[세미나] Vagrant 이지원[세미나] Vagrant 이지원
[세미나] Vagrant 이지원
 
OpenStack-Ansible Security
OpenStack-Ansible SecurityOpenStack-Ansible Security
OpenStack-Ansible Security
 
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
 
Building distribution packages with Docker
Building distribution packages with DockerBuilding distribution packages with Docker
Building distribution packages with Docker
 
Design Portfolio
Design PortfolioDesign Portfolio
Design Portfolio
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화
 

Similar to HP Advanced Technology Group: Docker and Ansible

Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
Samuel Chow
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
Laura Frank Tacho
 
MySQL | My SQL docker containerization | Docker Network
MySQL | My SQL docker containerization | Docker NetworkMySQL | My SQL docker containerization | Docker Network
MySQL | My SQL docker containerization | Docker Network
shrenikp
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
msyukor
 
Oracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdfOracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdf
Yossi Nixon
 
Docker+java
Docker+javaDocker+java
Docker+java
DPC Consulting Ltd
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
Cesar Maciel
 
Docker4Drupal 2.1 for Development
Docker4Drupal 2.1 for DevelopmentDocker4Drupal 2.1 for Development
Docker4Drupal 2.1 for Development
Websolutions Agency
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
InfluxData
 
Cicd.pdf
Cicd.pdfCicd.pdf
Cicd.pdf
ssuser37d481
 
DevOps: Docker Workshop
DevOps: Docker WorkshopDevOps: Docker Workshop
DevOps: Docker Workshop
Joonas Hämäläinen
 
Rails in docker
Rails in dockerRails in docker
Rails in docker
Andrew Klotz
 
DockerCC.pdf
DockerCC.pdfDockerCC.pdf
DockerCC.pdf
Cesar Capillas
 
DCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker ContainersDCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker Containers
Docker, Inc.
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Dana Luther
 
Into The Box 2018 | Content box + docker
Into The Box 2018 | Content box + dockerInto The Box 2018 | Content box + docker
Into The Box 2018 | Content box + docker
Ortus Solutions, Corp
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
Maciej Lukianski
 
Ansible+docker (highload++2015)
Ansible+docker (highload++2015)Ansible+docker (highload++2015)
Ansible+docker (highload++2015)
Pavel Alexeev
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
Thomas Tong, FRM, PMP
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
Daniel Nüst
 

Similar to HP Advanced Technology Group: Docker and Ansible (20)

Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
 
MySQL | My SQL docker containerization | Docker Network
MySQL | My SQL docker containerization | Docker NetworkMySQL | My SQL docker containerization | Docker Network
MySQL | My SQL docker containerization | Docker Network
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Oracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdfOracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdf
 
Docker+java
Docker+javaDocker+java
Docker+java
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
 
Docker4Drupal 2.1 for Development
Docker4Drupal 2.1 for DevelopmentDocker4Drupal 2.1 for Development
Docker4Drupal 2.1 for Development
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
 
Cicd.pdf
Cicd.pdfCicd.pdf
Cicd.pdf
 
DevOps: Docker Workshop
DevOps: Docker WorkshopDevOps: Docker Workshop
DevOps: Docker Workshop
 
Rails in docker
Rails in dockerRails in docker
Rails in docker
 
DockerCC.pdf
DockerCC.pdfDockerCC.pdf
DockerCC.pdf
 
DCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker ContainersDCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker Containers
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Into The Box 2018 | Content box + docker
Into The Box 2018 | Content box + dockerInto The Box 2018 | Content box + docker
Into The Box 2018 | Content box + docker
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
 
Ansible+docker (highload++2015)
Ansible+docker (highload++2015)Ansible+docker (highload++2015)
Ansible+docker (highload++2015)
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
 

Recently uploaded

一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 

HP Advanced Technology Group: Docker and Ansible

  • 1. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. Docker and Ansible Container management made easy
  • 2. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. About the speaker ● Patrick Galbraith ● HP Advanced Technology Group ● Has worked at Blue Gecko, MySQL AB, Classmates, Slashdot, Cobalt Group, US Navy, K-mart ● MySQL projects: memcached UDFs, DBD::mysql, federated storage engine ● Family ● Outdoors
  • 3. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted3 What is a container?
  • 4. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted4 Containers vs. VMs Containers ● Multiple isolated userspace instances ● Only libraries and components needed for application ● Runs on the same kernel (using Cgroups). ● Much smaller, easier to package ● VERY fast to start! ● Container runs using (a) specific process(es) ● SSH not needed ● Security limited to app VMs ● Entire OS installation ● Container runs within OS (using Cgroups). ● VM runs using emulation or virtualization on host OS ● Entire VM OS and disk images ● Longer to start ● SSH ● Security issues of running OS
  • 5. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted5 What is Docker? ● Application that manages containers (CLI, API) ● Automates the deployment of applications inside software containers ● Written in Go, Opensource dotCloud ● Uses union file system (AUFS) ● Can use CLI to search Docker repos for images ● "literally LXC with some awesomesauce on top” ● No “dependency hell”
  • 6. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted6 Why Docker? ● Makes it very easy to run and manage containers ● Configure/build once, run anywhere ● Small footprint in terms of disk and memory ● Well-suited for SaaS/PaaS ● Security - you are not running a VM and associated OS
  • 7. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted7 Docker concepts ● Images ● Read only layer ● Acts as a template for containers ● Inheritance ● images can be pushed to and pulled from public or private repos ● Dockerfile ● Used for building images ● Containers ● Applications run using containers
  • 8. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted8 Dockerfile example FROM ubuntu:13.04 MAINTAINER Patrick aka CaptTofu Galbraith , patg@patg.net # Update distribution RUN apt-get update && apt-get upgrade -y && apt-get clean RUN apt-get install -y ssh vim apache2-mpm-prefork RUN mkdir /var/run/sshd RUN mkdir /root/.ssh RUN chmod 700 /root/.ssh # entrypoint script ADD entrypoint.sh /usr/local/sbin/entrypoint.sh ADD docker.pem.pub /root/.ssh/authorized_keys RUN chown -R root:root /root/.ssh # Expose SSH and Apache EXPOSE 22 80 443 ENTRYPOINT ["/usr/local/sbin/entrypoint.sh"]
  • 9. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted9 Entrypoint script example #!/bin/bash /usr/sbin/sshd -D $@ service apache2 start
  • 10. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted10 Docker concepts
  • 11. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted11 Basic usage ● docker run ● Make changes ● docker commit ● docker push
  • 12. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted12 Dockerfile ● docker build –t username/my_image ● Container runs ● Each step results in an a commit (image being created) ● CMD vs. ENTRYPOINT
  • 13. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted13 Ansible + Docker ● docker module ● docker_images module ● docker_facts module ● Docker inventory plugin ● Uses docker-py Docker client python library
  • 14. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted14 What we used ● HP Moonshot ● New server – low power (1500W x2 min) ● Small footprint ● Designed for targeted workloads ● One 4.3 U container chassis ● 45 cartridges
  • 15. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted15 Install Docker $ ansible-galaxy install angstwad.docker_ubuntu - hosts:local connection: local roles: - angstwad.docker_ubuntu DOCKER_OPTS="--ip=0.0.0.0 --host=tcp://0.0.0.0:4243” Example: install docker install role Example: add options to template deployed to /etc/defaults/docker Example: playbook to install using docker install role
  • 16. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted16 Install Docker
  • 17. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted17 Install Docker Example: running ansible to verify that Docker is installed on containers
  • 18. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted18 docker_images module ● Builds Docker images ● Simple: add, build or remove - name: check or build percona XtraDB Cluster image docker_image: docker_url=“tcp://127.0.0.1:4243” path=”../docker-image-source/pxc/" name=”capttofu/pxc" state=present Example: playbook to build a Percona XtraDB Cluster
  • 19. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted19 docker_images module Example: build several images using playbook using docker_images
  • 20. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted20 docker_images module Example: Display of newly built images
  • 21. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted21 docker module ● Container provisioning – start, stop, delete containers ● Set parameters on a container Example: Playbook that builds Percona XtraDB Cluster image- name: docker image control local_action: module: docker docker_url: "tcp://somehost:4243" image: ”capttofu/percona_xtradb" name: ”db" state: ”present" publish_all_ports: yes
  • 22. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted22 docker module $ ansible-playbook site.yml -e 'hosts=moonshot' $ ansible-playbook site.yml -e 'hosts=moonshot docker_state=absent' Example: Docker container control
  • 23. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted23 docker module
  • 24. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted24 docker module
  • 25. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted25 docker_facts module ● Populate large dictionary docker_facts containing information about Docker container fleet and images ● Two primary dictionary entries: docker_containers and docker_images
  • 26. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted26 docker_facts module - name: Gather info about containers hosts: "{{ hosts }}" gather_facts: False tasks: - name: Get facts about containers local_action: docker_url: tcp://{{ inventory_hostname }}:4243 module: docker_facts - name: another facts test debug: msg="Host{{':'}} {{ inventory_hostname}} Container Name{{':'}} {{ item.key }} IP Address{{':'}} {{ item.value.docker_networksettings.IPAddress }} ssh port{{':'}} {{ item.value['docker_networksettings']['Ports']['22/tcp'][0]['HostPort'] }} with_dict: docker_containers Example: print out container fleet info
  • 27. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted27 docker_facts module
  • 28. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted28 docker_facts module - name: Gather info about containers hosts: docker gather_facts: True tasks: - name: Get facts about containers local_action: module: docker_facts name: db_1 images: aff77f73ca3d Example: print out specific container or images
  • 29. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted29 docker_facts module - name: Gather info about containers hosts: "{{ hosts }}" gather_facts: True tasks: - name: Get facts about containers local_action: docker_url: tcp://{{ inventory_hostname }}:4243 module: docker_facts images: all - name: images info debug: msg="Image ID {{ item.key }} Repo Tags {{ item.value.docker_repotags }}" with_dict: docker_images Example: Print out all images
  • 30. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted30 docker_facts module --- - name: Create an invetory file hosts: moonshot gather_facts: yes tasks: - name: Get facts about containers local_action: docker_url: tcp://{{ inventory_hostname }}:4243 module: docker_facts - name: docker_hosts template local_action: template src=docker_hosts.txt.j2 dest=./docker_hosts_{{ inventory_hostname }}.txt Example: Use docker_facts to print out inventory file
  • 31. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted31 docker_facts module [c10n1.atg.seattle.lan] c19n1_db_1 ansible_ssh_port=49270 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_db_2 ansible_ssh_port=49275 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_db_3 ansible_ssh_port=49280 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_haproxy_1 ansible_ssh_port=49285 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_haproxy_2 ansible_ssh_port=49287 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_haproxy_3 ansible_ssh_port=49289 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_haproxy_4 ansible_ssh_port=49291 ansible_ssh_host=c10n1.atg.seattle.lan c19n1_web_1 ansible_ssh_port=49240 ansible_ssh_host=c10n1.atg.seattle.lan ... {% for host in hostvars | sort %} [{{ host }}] {% for container in docker_containers | sort %} {{ container }} ansible_ssh_port={{ docker_containers[container]['docker_networksettings']['Ports']['22/tcp'][0 ansible_ssh_host={{ host }} {% endfor %} {% endfor %} The produced file: Jinja template:
  • 32. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted32 Docker Dynamic inventory ● Ability to manage elastic resources ● Plugins provide a JSON output that serves as an inventory list to use ● ansible –i plugin playbook.yml ● ansible –i docker.py main.yml
  • 33. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted33 Dynamic inventory --- - name: Create a docker.yml file hosts: moonshot gather_facts: yes tasks: - name: docker.yml template local_action: template src=docker.yml.j2 dest=./docker.yml Example: Playbook to create a dynamic inventory config file
  • 34. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted34 Dynamic inventory --- defaults: host: unix:///var/run/docker.sock version: 1.9 timeout: 60 private_ssh_port: 22 default_ip: 127.0.0.1 hosts: {% for key in hostvars %} - host: tcp://{{ key }}:4243 version: 1.9 timeout: 60 default_ip: {{ hostvars[key]['ansible_default_ipv4']['address'] }} {% endfor %} Example: Jinja template for docker inventory plugin config file
  • 35. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted35 Dynamic inventory hosts: - host: tcp://c29n1.atg.seattle.lan:4243 version: 1.9 timeout: 60 default_ip: 10.99.33.38 - host: tcp://c15n1.atg.seattle.lan:4243 version: 1.9 timeout: 60 default_ip: 10.99.33.24 - host: tcp://c14n1.atg.seattle.lan:4243 version: 1.9 timeout: 60 default_ip: 10.99.33.23 … Example: Produced docker inventory plugin config
  • 36. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted36 Dynamic inventory
  • 37. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted37 Cleanup
  • 38. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted38 Acknowledgements • Paul Durivage (https://github.com/angstwad) • Yazz Atlas (https://twitter.com/EntropyWorks) • Brian Aker (https://en.wikipedia.org/wiki/Brian_Aker, @brianaker, IRC krow) • Michael DeHaan (https://twitter.com/laserllama)
  • 39. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HP Restricted39 Resources • http://patg.net • https://galaxy.ansible.com/list#/users/1488 • http://docker.io • https://github.com/CaptTofu/ansible-docker-presentation • https://github.com/CaptTofu/docker-image-source • http://www.slideshare.net/PatrickGalbraith/docker-ansible-34909080 • http://blog.docker.io/2013/06/openstack-docker-manage-linux-containers- with-nova/ • https://index.docker.io/u/ewindisch/dockenstack/