0

I am new to Vagrant. I have read through Vagrant documentation, but I am still confused with both commands - vagrant add and vagrant init. I only know how vagrant init will initialize a VM instance but I'm not sure with vagrant add. Both look like the same for me. What's the actual difference between these 2?

doremi666
  • 121
  • 3
  • 15

1 Answers1

0

There's no vagrant add command - I assume your refer to vagrant box add.

You can also read https://stackoverflow.com/a/53657143/4296747 where I try to describe initial steps from vagrant.

to answer your question:

  • vagrant box add add a box into the box repository, it download a vagrant box file from internet and copy the files under your $HOME/.vagrant.d and pre-configure the box so it can be used when you will run a VM; it does not create any VM you can use.
  • vagrant init is just a basic script that will create a skeleton Vagrantfile. You run this command if you dont have any Vagrantfile to work with and you are not sure how to write one.

Note that if you have your own Vagrantfile you dont need the vagrant init and when running vagrant up vagrant automatically downloads the box for you so as a beginner you can skip vagrant box add

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139