Packer vs. Vagrant

11,993 views
Skip to first unread message

Tejay Cardon

unread,
Jul 1, 2013, 5:18:07 PM7/1/13
to packe...@googlegroups.com
Ok, I'm trying to understand how Packer relates to Vagrant.  In particular, what would I use a Vagrant provision-er to do vs. a Packer provision-er.  Or will Packer eventually replace vagrant entirely?

Thanks,
Tejay

Mitchell Hashimoto

unread,
Jul 1, 2013, 5:34:56 PM7/1/13
to packe...@googlegroups.com
Tejay,

I'm glad you asked this. This hasn't come up on the mailing list yet and I've wanted an opportunity to talk about this.

First off, Packer does not require or even encourage Vagrant usage. Packer stands on its own as a useful tool for its own purposes: namely, building machine images for whatever environment you require. 

However, Packer is very useful alongside Vagrant, if you want. Packer can create Vagrant boxes. So if you wanted Vagrant boxes, then Packer can do this for you. This is the ONLY way Packer helps you use Vagrant. It does not REPLACE any part of Vagrant. 

So why would you want to create Vagrant boxes? Tons of reasons, but here are the most common:

* You want a custom OS or custom prepared box. You're generally tied to publicly available boxes (such as the ones I make). With Packer, you can create your own custom box that has your own OS installed in some specific way. This is useful if you want to match what runs in production more closely.

* You want to pre-run provisioners so that `vagrant up` is faster. With Packer, you can run Chef/Puppet/etc. beforehand and bake it into an image, essentially getting rid of the provision time when doing a `vagrant up`. This can speed things up drastically. A lot of bigger companies do this sort of thing because running provisioning is pretty heavy.

* You want to create Vagrant boxes that are as close as possible to production, so you generate both boxes and AMIs (for production, or any other type) at the same time with Packer.

Hope this helps.

Best,
Mitchell



--
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Christopher Webber

unread,
Jul 1, 2013, 5:53:17 PM7/1/13
to packe...@googlegroups.com
Tejay,

One of the things we have been talking about doing internally is preloading mysql and mongo instances before baking the vagrant boxes to make things faster to spin up for devs. Packer makes this task trivial. We would then use those pre-baked instances alongside standard vagrant boxes in our Vagrantfiles.

-- cwebber

Jim Alateras

unread,
Jul 2, 2013, 6:45:17 PM7/2/13
to packe...@googlegroups.com
Mitchell,

Once you have done the provisioning using vagrant can't you box it up therefore achieve the same thing or am i missing something here.

cheers
</jima>

Mitchell Hashimoto

unread,
Jul 2, 2013, 11:30:12 PM7/2/13
to packe...@googlegroups.com
Jim,

Response inline:


On Tue, Jul 2, 2013 at 3:45 PM, Jim Alateras <j...@sutoiku.com> wrote:
Mitchell,

Once you have done the provisioning using vagrant can't you box it up therefore achieve the same thing or am i missing something here.

Yes, but this only works for VirtualBox. None of the other providers currently really support the `package` functionality. Also, this requires a source box to begin with. Packer can solve this base box step. Additionally, I plan on supporting packaging up pre-existing running environments with Packer, and this will replace the `vagrant package` functionality.

In fact, it is very likely in the future that Vagrant installers will also ship with Packer in them to handle this functionality.

Best,
Mitchell

Fábio Rehm

unread,
Jul 4, 2013, 10:25:36 AM7/4/13
to packe...@googlegroups.com
Oh well, vagrant-lxc does support the package functionality, and it has supported it for the last 3 / 4 months. But yeah, I do want to leverage Packer if that is going to replace `vagrant package` functionality, I just need to find the time to learn some Golang and contribute back support for building linux containers :D

Cheers,
--
Fábio Rehm

Dan Lovell

unread,
Sep 8, 2013, 10:38:31 PM9/8/13
to packe...@googlegroups.com
Hi Mitchell,

Does the notion of a 'source box' relate to Vagrant requiring VirtualBox Guest Additions to be installed to whatever VM that Vagrant is working with?  (And probably similarly VMware VIX API for a VMware image).

I would really like to not have to install Guest Additions or VIX API as this is the only manual step left when I create VMs for projects.  It seems like Packer does not require this manual step to set up the VM, is that correct?

Is there some functionality of Packer that automagically installs Guest Additions/VIX API or steps around it?  The other remaining problem I have with VMware VMs is that every time I install a kernel update on my Ubuntu host, I need to reinstall VIX API on the guest.  Does Packer have functionality that would help me get around this, even if I had to repurpose/hack some existing Packer functionality?

Thanks
Dan

Mitchell Hashimoto

unread,
Sep 10, 2013, 2:13:34 AM9/10/13
to packe...@googlegroups.com, Dan Lovell
Dan,


On September 8, 2013 at 7:53:06 PM, Dan Lovell (dlo...@gmail.com) wrote:

Hi Mitchell,

Does the notion of a 'source box' relate to Vagrant requiring VirtualBox Guest Additions to be installed to whatever VM that Vagrant is working with?  (And probably similarly VMware VIX API for a VMware image).

It is not strictly required: if you disable all shared folders (or only use NFS), then Vagrant has no need for the guest additions and will work perfectly fine without. CoreOS, for example, ships Vagrant boxes that do not use any guest addition functionality.



I would really like to not have to install Guest Additions or VIX API as this is the only manual step left when I create VMs for projects.  It seems like Packer does not require this manual step to set up the VM, is that correct?

Correct.



Is there some functionality of Packer that automagically installs Guest Additions/VIX API or steps around it?  The other remaining problem I have with VMware VMs is that every time I install a kernel update on my Ubuntu host, I need to reinstall VIX API on the guest.  Does Packer have functionality that would help me get around this, even if I had to repurpose/hack some existing Packer functionality?

Not at the moment, though I'd like to be able to support something like this. For the time being, this is possible with two separate builds.

Dan Lovell

unread,
Sep 14, 2013, 9:48:05 PM9/14/13
to packe...@googlegroups.com, Dan Lovell
On Tuesday, September 10, 2013 2:13:34 AM UTC-4, Mitchell Hashimoto wrote:
Dan,


On September 8, 2013 at 7:53:06 PM, Dan Lovell (dlo...@gmail.com) wrote:

Hi Mitchell,

Does the notion of a 'source box' relate to Vagrant requiring VirtualBox Guest Additions to be installed to whatever VM that Vagrant is working with?  (And probably similarly VMware VIX API for a VMware image).

It is not strictly required: if you disable all shared folders (or only use NFS), then Vagrant has no need for the guest additions and will work perfectly fine without. CoreOS, for example, ships Vagrant boxes that do not use any guest addition functionality.



I would really like to not have to install Guest Additions or VIX API as this is the only manual step left when I create VMs for projects.  It seems like Packer does not require this manual step to set up the VM, is that correct?

Correct.



Is there some functionality of Packer that automagically installs Guest Additions/VIX API or steps around it?  The other remaining problem I have with VMware VMs is that every time I install a kernel update on my Ubuntu host, I need to reinstall VIX API on the guest.  Does Packer have functionality that would help me get around this, even if I had to repurpose/hack some existing Packer functionality?

Not at the moment, though I'd like to be able to support something like this. For the time being, this is possible with two separate builds.

In the context of Packer not automagically installing VIX API tools, what is the purpose of tools_upload_{path,flavor}?  Those variable names suggest to me that VMware VIX API tools are being installed.

Thanks
Dan
 
Reply all
Reply to author
Forward
0 new messages