SlideShare a Scribd company logo
1 of 18
Vagrant + Docker
building portable environments
David Giordano
@3dgiordano
Introduction
• What is Vagrant?
• Created by Mitchell Hasimoto
• Provisioning Tools for Dev, Production & Test Environments
• Syntactic sugar around VMs and Containers
• Syntactic sugar around provisioning
• Why use Vagrant?
• Quick
• Easily replicate production on a Dev box
• Easily go production from a Dev box
• Mature, stable, proven
Step 1: Install Vagrant
• http://www.vagrantup.com/downloads.html
• Mac OSX
• Windows
• Debian/Ubuntu
• CentosOS/Redhat/Fedora
Step 2: Project Setup
$ mkdir vagrant_getting_started
$ cd vagrant_getting_started
$ vagrant init
Step 3: Select a Box
• http://www.vagrantbox.es
• Ubuntu, OpenSuse, OpenBSD, CentOS, Debian..
• Select Provider (VM or Container)
Step 4: Show/Edit Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = “precise64“
config.vb.box_url = “http://bit.ly/1gLmNF0”
end
Step 5: Up!
$ vagrant up
Step 6: Connect!
$ vagrant ssh
Success!!
More Commands
• status : status of the machine
• halt : stop machine
• suspend : suspend machine
• reload : restar machine (load new vagrantfile)
• resume : resume suspended machine
• provision : force provisionning machine
• destroy : stop and delete machine
• box : manages boxes
• …
More Providers
(native or plugin)
• VMs:
• VirtualBox, KVM, Hyper-V, VMware, libvirt
• Containers:
• lxc, docker
• Services:
• AWS, DigitalOcean, HP Cloud, Joyent,
Rackspace, OpenStack, CloudStack, vSphere…
Customize
• config.vm.box* : Box information
• config.vm.network* : Network
• config.ssh* : SSH connection
• config.vm.synced_folder : Share folder
• config.vm.provider* : Custom provider settings
• config.vm.provision* : Provisioning (Puppet, Chef, Docker,
Shell…)
Provisioning?
• Automatically install software, alter configuration and more
• Shell Scripts
• File
• Puppet (Standalone & Agent)
• Chef (Solo & Client)
• Ansible
• Salt
• Docker!!!
• Open-Source Container for Dummies
• Create lightweight, portable, self-sufficient container from any
app.
• Build once… run anywhere
• Configure once… run anything
• Ecosystems! OS, VM’s, PaaS, IaaS…
• Base: LXC, OpenVZ, systemd-nspawn, libvirt-lxc, libvirt-sandbox,
qemu/kvm, Jails, Solaris Zones, chroot (0.9*)
Vagrant and Docker
• BOX = Machine
• Docker = Container (App package inside the Box)
• Functions: Pull, Build, Run
• Allow others provisioning (Shell, puppet, chef)
Docker in Vagrantfile
Vagrant.configure("2") do |config|
v = config.vm
v.box = "precise64"
v.box_url = "http://bit.ly/1gLmNF0"
v.network "forwarded_port", guest: 5000, host: 9292
v.provision "docker", images: [“dg/docker-sample"]
v.provision “docker“ do |d|
d.run “dg/docker-sample”, args: "-p 5000:5000“
end
end
Up!
$ vagrant up
Connect!
Success!!
Want to learn more?
• www.vagrantup.com
• GitHub mitchellh/vagrant
• Twitter @vagrantup @mitchellh
• www.docker.io
• GitHub dotcloud/docker
• Twitter @docker

More Related Content

What's hot

Docker workshop
Docker workshopDocker workshop
Docker workshop
Evans Ye
 

What's hot (20)

Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + Docker
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Vagrant presentation
Vagrant presentationVagrant presentation
Vagrant presentation
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant
VagrantVagrant
Vagrant
 
Vagrant
Vagrant Vagrant
Vagrant
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfContinuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
 
Vagrant & Docker
Vagrant & DockerVagrant & Docker
Vagrant & Docker
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Automated Deployment with Capistrano
Automated Deployment with CapistranoAutomated Deployment with Capistrano
Automated Deployment with Capistrano
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13
 
Continuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscale
 
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
 
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
 

Viewers also liked

A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
Wen-Tien Chang
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
dotCloud
 

Viewers also liked (20)

Vagrant + ansible vs docker
Vagrant + ansible vs dockerVagrant + ansible vs docker
Vagrant + ansible vs docker
 
Docker on Windows
Docker on WindowsDocker on Windows
Docker on Windows
 
Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 
Software Containerization
Software ContainerizationSoftware Containerization
Software Containerization
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerization
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersDocker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server Containers
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 
Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Containerization
ContainerizationContainerization
Containerization
 
Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
 
Moving Legacy Applications to Docker by Josh Ellithorpe, Apcera
Moving Legacy Applications to Docker by Josh Ellithorpe, Apcera Moving Legacy Applications to Docker by Josh Ellithorpe, Apcera
Moving Legacy Applications to Docker by Josh Ellithorpe, Apcera
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 

Similar to Vagrant + Docker

2 Linux Container and Docker
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
Fabio Fumarola
 
Intro to Docker October 2013
Intro to Docker October 2013Intro to Docker October 2013
Intro to Docker October 2013
Docker, Inc.
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013
Docker, Inc.
 

Similar to Vagrant + Docker (20)

Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and Docker
 
2 Linux Container and Docker
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and docker
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker EcosystemDocker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
 
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on AzureDocker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
 
Deploying to Ubuntu on Linode
Deploying to Ubuntu on LinodeDeploying to Ubuntu on Linode
Deploying to Ubuntu on Linode
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
 
Intro to Docker October 2013
Intro to Docker October 2013Intro to Docker October 2013
Intro to Docker October 2013
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
 
Docker-Intro
Docker-IntroDocker-Intro
Docker-Intro
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
About docker in GDG Seoul
About docker in GDG SeoulAbout docker in GDG Seoul
About docker in GDG Seoul
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Vagrant + Docker

  • 1. Vagrant + Docker building portable environments David Giordano @3dgiordano
  • 2. Introduction • What is Vagrant? • Created by Mitchell Hasimoto • Provisioning Tools for Dev, Production & Test Environments • Syntactic sugar around VMs and Containers • Syntactic sugar around provisioning • Why use Vagrant? • Quick • Easily replicate production on a Dev box • Easily go production from a Dev box • Mature, stable, proven
  • 3. Step 1: Install Vagrant • http://www.vagrantup.com/downloads.html • Mac OSX • Windows • Debian/Ubuntu • CentosOS/Redhat/Fedora
  • 4. Step 2: Project Setup $ mkdir vagrant_getting_started $ cd vagrant_getting_started $ vagrant init
  • 5. Step 3: Select a Box • http://www.vagrantbox.es • Ubuntu, OpenSuse, OpenBSD, CentOS, Debian.. • Select Provider (VM or Container)
  • 6. Step 4: Show/Edit Vagrantfile VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = “precise64“ config.vb.box_url = “http://bit.ly/1gLmNF0” end
  • 7. Step 5: Up! $ vagrant up Step 6: Connect! $ vagrant ssh
  • 9. More Commands • status : status of the machine • halt : stop machine • suspend : suspend machine • reload : restar machine (load new vagrantfile) • resume : resume suspended machine • provision : force provisionning machine • destroy : stop and delete machine • box : manages boxes • …
  • 10. More Providers (native or plugin) • VMs: • VirtualBox, KVM, Hyper-V, VMware, libvirt • Containers: • lxc, docker • Services: • AWS, DigitalOcean, HP Cloud, Joyent, Rackspace, OpenStack, CloudStack, vSphere…
  • 11. Customize • config.vm.box* : Box information • config.vm.network* : Network • config.ssh* : SSH connection • config.vm.synced_folder : Share folder • config.vm.provider* : Custom provider settings • config.vm.provision* : Provisioning (Puppet, Chef, Docker, Shell…)
  • 12. Provisioning? • Automatically install software, alter configuration and more • Shell Scripts • File • Puppet (Standalone & Agent) • Chef (Solo & Client) • Ansible • Salt • Docker!!!
  • 13. • Open-Source Container for Dummies • Create lightweight, portable, self-sufficient container from any app. • Build once… run anywhere • Configure once… run anything • Ecosystems! OS, VM’s, PaaS, IaaS… • Base: LXC, OpenVZ, systemd-nspawn, libvirt-lxc, libvirt-sandbox, qemu/kvm, Jails, Solaris Zones, chroot (0.9*)
  • 14. Vagrant and Docker • BOX = Machine • Docker = Container (App package inside the Box) • Functions: Pull, Build, Run • Allow others provisioning (Shell, puppet, chef)
  • 15. Docker in Vagrantfile Vagrant.configure("2") do |config| v = config.vm v.box = "precise64" v.box_url = "http://bit.ly/1gLmNF0" v.network "forwarded_port", guest: 5000, host: 9292 v.provision "docker", images: [“dg/docker-sample"] v.provision “docker“ do |d| d.run “dg/docker-sample”, args: "-p 5000:5000“ end end
  • 18. Want to learn more? • www.vagrantup.com • GitHub mitchellh/vagrant • Twitter @vagrantup @mitchellh • www.docker.io • GitHub dotcloud/docker • Twitter @docker