can I use a local downloaded image in kitchen.yml

703 views Asked by At

I am a Windows 10 user. Installed VMbox, Vagrant in my local.

I want to do kitchen test and do changes before I work on Openstack staging environment.

But every time I do kitchen test it downloads the imaged from web and takes a while to create the box. Instead of that can I use the local downloaded image to create box every time i run kitchen test.

Is there a way?

3

There are 3 answers

0
coderanger On

Vagrant automatically caches box images so whatever you think is happening probably isn't. The only way this wouldn't be the case is if you were changing the box name every time.

0
Mrigesh Priyadarshi On

If you have downlaoded the image and added to vagrant, then

vagrant box list

Would result into list of vagrant boxes available, i.e,

Mrigesh:~ mpriyada$ vagrant box list
CentOS6.5          (virtualbox, 0)
CentOS7.0          (virtualbox, 0)

Once Available, you can specify the box name under driver tag in kitchen.yml, like

---
driver:
  name: vagrant
  provider: virtualbox
  box: CentOS7.0
0
Draco Ater On

In Vagrantfile most probably you have 2 configuration lines:

config.vm.box = 'somename'
config.vm.box_url = 'http://someurl'

When you run vagrant up (that's what Test Kitchen does too) Vagrant checks, if the box with the name already exists. Only if it does not, it starts downloading it from the box_url.

So either you somehow delete the box, so it gets downloaded every time. Or you have some random value in box name, so vagrant thinks those all are different boxes. Check what boxes you have downloaded with

vagrant box list