fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.08k stars 111 forks source link

Use image for bucket name with docker, if box is unset #116

Closed jbarbuto closed 9 years ago

jbarbuto commented 10 years ago

This allows multiple machines using the image to share the cache and avoids the following error:

/Applications/Vagrant/embedded/lib/ruby/2.0.0/pathname.rb:389:in
`initialize': no implicit conversion of nil into String (TypeError)
fgrehm commented 10 years ago

Sounds reasonable to me, but from the error you pointed out it seems that you are using the docker provider from a MacOS machine with the docker host / boot2docker and, if I'm not mistaken, by default you won't get the packages synced back to your host because it uses rsync synced folders. Are you doing something different than that?

I still think that's valuable for linux users running docker natively and will look into merging it as soon as I have a chance. Thanks a lot :beers:

jbarbuto commented 10 years ago

Sorry, should have mentioned I'm using a box from https://github.com/phusion/open-vagrant-boxes as the host VM, which defaults to VirtualBox synced folders. Perhaps we could detect if boot2docker is being used and warn accordingly, or whether an rsync synced folder is being used in general?

fgrehm commented 10 years ago

Perhaps we could detect if boot2docker is being used and warn accordingly, or whether an rsync synced folder is being used in general?

Yeah, but I'd rather just error out instead of warn as it is likely to be an undesired behavior (unless there is some two way rsync in place that I'm not aware of). I'm just not sure how to detect that right now because we can't rely on Vagrantfile configs as each provider has its defaults.

As for this PR, I haven't been able to give this a try but I'll look into doing that and merging it as soon as possible. If you can't do the rsync detection don't worry, it's "out of scope" for this PR anyways :smile_cat:

jbarbuto commented 10 years ago

Agreed that erroring out is preferable to a warning with rsync synced folders. Another case where it seems appropriate is when the docker provider is being used with build_dir for building images on demand. I've added another commit to ensure that image is set.

fgrehm commented 9 years ago

Many thanks! This is likely to be the last feature that will get into 1.0 :beers: