diff --git a/lib/vagrant-cachier/action/configure_bucket_root.rb b/lib/vagrant-cachier/action/configure_bucket_root.rb index e1b5480..86e87c2 100644 --- a/lib/vagrant-cachier/action/configure_bucket_root.rb +++ b/lib/vagrant-cachier/action/configure_bucket_root.rb @@ -33,7 +33,14 @@ module VagrantPlugins def cache_root @cache_root ||= case @env[:machine].config.cache.scope.to_sym when :box - @env[:home_path].join('cache', box_name) + @box_name = box_name + # Box is optional with docker provider, so use image name if unset + if @box_name.nil? && @env[:machine].provider_name.to_sym == :docker + bucket_name = image_name.gsub(':', '-') + else + bucket_name = @box_name + end + @env[:home_path].join('cache', bucket_name) when :machine @env[:machine].data_dir.parent.join('cache') else @@ -44,6 +51,10 @@ module VagrantPlugins def box_name @env[:machine].config.vm.box end + + def image_name + @env[:machine].provider_config.image + end end end end