DevOps
  • DevOps
  • Docker
    • Overview
  • Vagrant
    • Overview
    • Installation
    • Basic Commands
    • Vagrantfile
      • Example
    • Deploying Multiple Machine
    • Distribution
    • Reference
  • Running SQL Server on Windows Docker
    • Introduction
      • Windows Container & Hyper-V Container
    • System Requirements and Prerequisites
    • Version Compatibility
    • Enable Hyper-V & Containers and Install Docker on Window Servers
    • Using Docker to Run MSSQL Image
    • Install SSMS for remoting MSSQL Server Image
    • Using Docker-Compose to Build Up a MSSQL Image
    • Increase the default Windows container's storage
    • Reference
    • Appendix
  • Kubernetes
    • Install Kubernetes with kubeasz
    • Use Hyper-V Manager to create VM for K8S
      • Specification of the VM
      • Use Hyper-V Manager to turn on a VM for K8S
    • Installation
      • Install VirtualBox and its extension on Ubuntu
      • Install kubectl
      • Install minikube
    • Getting Started
      • Running Kubernetes Locally via Minikube
    • Assign Memory Resources to Containers and Pods
    • Assign CPU Resources to Containers and Pods
    • Quality of Services (QoS)
    • Volume for Storage
      • Configure a Pod to Use a Volume for Storage
      • *Configure a Pod to Use a PersistentVolume for Storage
    • In a nutshell...
    • Reference
  • Ansible
    • What is Ansible?
    • Set Up OS Environments for Ansible
    • Install Ansible
    • Structure for ansible
      • Inventory
      • Playbook
      • Modules
      • Variables
      • Conditions
    • Security - Ansible Fault
    • 實際操作測試1 - 使用ssh
    • 實際操作測試2 - Docker容器部署
    • Appendix
    • Reference
  • Azure
    • Overview
    • Terms
    • Getting Started
    • Azure DevOps Services
    • Reference
Powered by GitBook
On this page
  • Docker and vagrant?
  • So, What is Vagrant?
  • Any use cases for vagrant?

Was this helpful?

  1. Vagrant

Overview

PreviousOverviewNextInstallation

Last updated 6 years ago

Was this helpful?

Docker and vagrant?

Vagrant 與 Docker 相同之處都是要解決環境相依的問題,但是對象不同。Vagrant 焦距在開發當下,只要我的專案含有 Vagrantfile 及機器裝有 VirtualBox,開發者在任何一台機器都可以開發。Docker 則焦距在應用服務的部署,但也涉及開發的方法,在開發時就會直接用 container 來實作。 兩者可以各別使用,但又可相輔相,一切取決於使用情境。

如果你僅僅是想管理虛擬機,那麼你應該使用vagrant。如果你想快速開發和部署應用,那麼應該使用docker。vagrant是一款管理虛擬機的工具,而docker是一款通過將應用打包到輕量級容器,而實現構建和部署的工具。

Vagrant is a tool for managing developing environment. Docker is a tool for building and deploying applications by packaging them into lightweight containers. —

So, What is Vagrant?

Vagrant enables users to create and configure lightweight, reproducible, and portable development environments. It is a tool for building and managing virtual machine environments in a single workflow.

With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the "works on my machine" excuse a relic of the past.

The basic unit is box. The name of a box is consist of username and boxname. For example, ubuntu/trusty64 is the official Ubuntu 16.04. One box is possible to have multiple version, e.g. ubuntu/trusty63:v1234.

Box is an image, Project is a container.

Any use cases for vagrant?

Unlike docker, vagrant use virtual box (possible others) to create a VM. It provides a way to reproduce the actual production environment which may contains multiple containers.

Imagine that you are developing a services in a huge system and others are developing the rest, how can you test your code independently (their code may be buggy under development)?

In this situation, DevOps can create a stable system snapshot and reproduce it by vagrant (repeat! vagrant just a tool to manage vm). Every developer can have this box and use it in their own development environment. This environment is the same for everyone (cross-platform). They do not need to worry whether their testing will affect each other. Of course, they interaction (API) should be designed by contract. But under this contract, they can work independently even in testing. After the works are done, they can put all the components together in the same environment (box) to test their integration.

On the other, if your production os is ubuntu 16.04, will you be confident that it will work in ubuntu 18.04? Of course not! In this situation, you can just replace the the base image in the scripts and then you can easily test your codes.

Solomon Hykes