This is the 21st day of my participation in the August Text Challenge.More challenges in August

Docker provides a containerized lightweight environment, but it is too lightweight and has a short life cycle. (Check out my other Docker post for more).

The differences can be summarized as follows:

Docker is developed based on Go language, using LXC (Linux kernel container Virtualization), CGroup, Linux kernel, etc., directly relying on system functions to provide infrastructure.

Vagrant builds infrastructure based on infrastructure automation tools Chef or Puppet, or user-provided scripts that manipulate images.

This topic is somewhat contrarian, but Vagrant is worth learning to use! Vagrant is a shell compared to Docker, which is at the heart of the most popular infrastructure containerization.

Sometimes we need a complex and customized operating system environment (such as setting up a cluster). What can we do?

Method 1: Install a VM using the CLI on a GRAPHICAL user interface (GUI).

This method does not have the effect of reuse, except that the virtual machine can be exported and imported by others using Virtualbox.

This requires that the virtual machine software on the other side be the same, and sometimes there are version compatibility issues, so the image can only be reused.

Method 2: Use Vagrant, which follows infrastructure-as-code nicely

To create a virtual machine construct from a script.

This approach is more compatible than the former, as Vagrant divides machine builds into two parts: host deployment and custom script execution.

So, the difference between a virtual machine and Vagrant:

Virtual machine software (VirtualBox, VMWare, etc.) provides a user interface for users to import basic images, load and start specified operating system images, and system images with interfaces. By manual operation. Or there is no interface terminal to tap commands for subsequent customization.

Vagrant provides scripts based on Chef or Puppet or the user to manipulate images, build infrastructure, and, more importantly, build through configuration scripts.

As you can see here, with the latter Vagrant, it is possible to redo the same operating environment again at any time, as long as all changes related to the environment (server) are passed through provisioner (script /Puppet, etc.).

Vagrant::Config.run do |config|
  config.vm.provision :puppet.:manifest_file= >"init.pp"
end
Copy the code

Okay, so here’s a recap of Vagrant

Vagrant is a tool for building and managing virtual machines.

It can automate the construction of virtual machine operating system, support multiple virtual machine to provide carrier, can be VirtualBox, VMware and other commonly used virtual machine software;

All three virtual machines were built using Vagrant.

Carrier can also use the AWS as the carrier, more information can be read: www.vagrantup.com/docs/provid…

More Vagrant concepts can be found at www.vagrantup.com/intro

Below, Vagrant towers over other virtual machines (currently operating the AWS Amazon cloud as well)

With the concept behind us, let’s look at the Vagant component:

Two common commands

Start a virtual machine: Vagrant Up

Shut down the virtual machine: Vagrant Halt

Thank you For pointing out that I misremembered the stop command. Remember to stop all the time, and I get this.)

Also most commonly used: Vagrant SSH login host.

Knowing what a Vagrant is is a good place to start.

For more Vagrant Demo content check out the previous Vagrant notes from the Committee.

Continuous learning and continuous development, I am Lei Xuewei! Programming is fun. The key is to get the technology right. Creation is not easy, please support, like collection support committee!

Additional links:

Blog.scottlowe.org/2016/09/15/…