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?
Asked
Active
Viewed 129 times
1 Answers
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 addadd a box into the box repository, it download a vagrant box file from internet and copy the files under your$HOME/.vagrant.dand 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 initis just a basic script that will create a skeletonVagrantfile. 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