# Kitchen-Docker Much Slower than Kitchen-Vagrant

**URL:** <https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490>\
**Category:** Chef Infra (archive)\
**Created:** [April 4, 2015, 2:47pm UTC](https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490 "2015-04-04T14:47:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jimmy_huang/32/119_2.png) [@Jimmy\_Huang](https://discourse.chef.io/u/Jimmy_Huang)\
**Post date:** [April 4, 2015, 2:47pm UTC](https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490/1 "2015-04-04T14:47:11Z")

</div>

Hi,

I am trying out kitchen-docker as a replacement for kitchen-vagrant, hoping  
to speed up my integration tests. Unfortunately, the tests take ten times  
as long to run with kitchen-docker compared to kitchen vagrant. I am on  
test-kitchen 1.3.1 and kitchen-docker 1.7.0. Below is my .kitchen.yml. I  
used Boot2Docker to install Docker and Vagrant on my machine. Thank you  
for your help.

Jimmy

[https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984](https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984)

* * *

driver:  
name: docker

provisioner:  
name: chef\_zero  
data\_bags\_path: test/fixtures/data\_bags  
environments\_path: test/fixtures/environments

platforms:

- name: ubuntu-14.04  
driver\_config:  
image: ubuntu:14.04  
container\_name: ubuntu\_test\_1404  
platform: ubuntu  
attributes:

suites:

- name: stag  
provisioner:  
client\_rb:  
environment: masterwrap-stag  
run\_list:
  - recipe[masterwrap::default]  
attributes:

---

<div class="post-metadata">

**Author:** ![Giovanni\_Toraldo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/giovanni_toraldo/32/89_2.png) [@Giovanni\_Toraldo](https://discourse.chef.io/u/Giovanni_Toraldo)\
**Post date:** [April 4, 2015, 4:04pm UTC](https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490/2 "2015-04-04T16:04:29Z")

</div>

Hi,

Il giorno sab 4 apr 2015 alle ore 16:47 Jimmy Huang  
[jimmy.huang@duragility.com](mailto:jimmy.huang@duragility.com) ha scritto:

> I am trying out kitchen-docker as a replacement for kitchen-vagrant, hoping to speed up my integration tests. Unfortunately, the tests take ten times as long to run with kitchen-docker compared to kitchen vagrant. I am on test-kitchen 1.3.1 and kitchen-docker 1.7.0. Below is my .kitchen.yml. I used Boot2Docker to install Docker and Vagrant on my machine. Thank you for your help.

This is not a surprise, if you use boot2docker on windows/mac you are  
just adding an additional layer in the virtualization stack and I/O  
performances can't be better than Virtualbox stand-alone.

---

<div class="post-metadata">

**Author:** ![Chip](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/chip/32/15_2.png) [@Chip](https://discourse.chef.io/u/Chip)\
**Post date:** [April 6, 2015, 8:57pm UTC](https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490/3 "2015-04-06T20:57:58Z")

</div>

There’s some caveats with kitchen-docker. When the cache is cold, things are slow. Once it’s warmed up, things tend to be really fast. In my experience, the first run with kitchen-docker is about the same speed or a bit slower than an equivalent Vagrant run.

Also, you can’t do your first kitchen run in parallel with a cold boot2docker. The disk usage in the vm tends to increase faster than the guest-disk-auto-resize in virtualbox can manage, and my runs fail as a result. Serialize the first time through.

All that said, subsequent runs are much, much faster and parallelize no problem.

My setup:

Retina MBP Mid–2012 (Core i7 16GB RAM)  
OSX 10.10.2  
boot2docker 1.5.0 (from brew cask)  
docker 1.5.0 (from brew cask)  
chefdk 0.4.0  
VMWare Fusion 7.1.1  
Vagrant 1.7.2  
vagrant-vmware-fusion (3.2.0)  
Have my vagrant box already cached  
Here’s a repo with a very simple recipe, just one template and an attribute feature flag. The repo contains a .kitchen.yml that does 3 suites: [https://github.com/charlesjohnson/fundamentals-with-tests/blob/master/chef-repo/cookbooks/motd/.kitchen.yml](https://github.com/charlesjohnson/fundamentals-with-tests/blob/master/chef-repo/cookbooks/motd/.kitchen.yml)

Here’s my .kitchen.local.yml that I layer in on top of it:

driver\_plugin: docker  
driver\_config:  
provision\_command: curl -L [https://www.opscode.com/chef/install.sh](https://www.opscode.com/chef/install.sh) | bash  
require\_chef\_omnibus: false  
use\_sudo: false  
Turning off the require\_chef\_omnibus flag and manually curl-pipe-bash’ing puts the installation of chef-client into its own layer in the docker cache. Slow the first time, zippy as hell afterward.

Here’s some quick informal benchmarks for those runs, just doing a kitchen destroy; kitchen converge (no busser):

Kitchen-Docker (cold booted VM, no layers cached at all, no parallel):  
-----\> Kitchen is finished. (2m38.15s)

Kitchen-Docker (warm cache, no parallel): -----\> Kitchen is finished. (0m22.73s)

Kitchen-Docker (warm cache, parallel): -----\> Kitchen is finished. (0m7.02s)

So by using kitchen-docker I get 8-second kitchen runs, including machine creation from scratch each time. Not bad at all.

Thanks,  
–Charles

Charles Johnson — Product Engineer  
(510) 545-9485 – [charles@chef.io](mailto:charles@chef.io) – my: Linkedin Twitter

CHEF

> **[Chef: Automate infrastructure and applications.](https://www.chef.io/)**
>
> Chef is built to work with all of your technology, so you can overcome the complexity of hybrid environments and rapidly ship your infrastructure and apps anywhere.

TM  
[chef.io](http://chef.io) Blog Facebook Twitter Youtube

On April 4, 2015 at 7:47:45 AM, Jimmy Huang ([jimmy.huang@duragility.com](mailto:jimmy.huang@duragility.com)) wrote:

Hi,

I am trying out kitchen-docker as a replacement for kitchen-vagrant, hoping to speed up my integration tests. Unfortunately, the tests take ten times as long to run with kitchen-docker compared to kitchen vagrant. I am on test-kitchen 1.3.1 and kitchen-docker 1.7.0. Below is my .kitchen.yml. I used Boot2Docker to install Docker and Vagrant on my machine. Thank you for your help.

Jimmy

[https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984](https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984)

* * *

driver:  
name: docker

provisioner:  
name: chef\_zero  
data\_bags\_path: test/fixtures/data\_bags  
environments\_path: test/fixtures/environments

platforms:

- name: ubuntu-14.04  
driver\_config:  
image: ubuntu:14.04  
container\_name: ubuntu\_test\_1404  
platform: ubuntu  
attributes:

suites:

- name: stag  
provisioner:  
client\_rb:  
environment: masterwrap-stag  
run\_list:
- recipe[masterwrap::default]  
attributes:

---

<div class="post-metadata">

**Author:** ![tknerr](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tknerr/32/21_2.png) [@tknerr](https://discourse.chef.io/u/tknerr)\
**Post date:** [April 26, 2015, 8:43pm UTC](https://discourse.chef.io/t/kitchen-docker-much-slower-than-kitchen-vagrant/6490/4 "2015-04-26T20:43:18Z")

</div>

Hey Charles,

thanks for posting this!

I now get similar numbers on a Windows host with docker 1.6 / boot2docker.  
This is making test-kitchen on windows fun again! 🙂

As for the provision command, I'm now using this:

driver\_config:  
provision\_command:  
- curl -L [https://www.opscode.com/chef/install.sh](https://www.opscode.com/chef/install.sh) | bash -s -- -p -v 12.3.0  
- env GEM\_HOME=/tmp/verifier/gems GEM\_PATH=/tmp/verifier/gems  
GEM\_CACHE=/tmp/verifier/gems/cache /opt/chef/embedded/bin/gem install  
thor busser busser-serverspec serverspec bundler && chown -R  
kitchen:kitchen /tmp/verifier

1. installs a specific chef version, 12.3.0 rc pre-release in this case
2. pre-caches the busser installed gems in for test-kitchen 1.4.0.rc1  
(thanks @coderanger!)

Gives me around -----\> Kitchen is finished. (0m21.66s) for a full converge

- test + destroy run (i.e. kitchen test -c) in the above motd example

Cheers,  
Torben

On Mon, Apr 6, 2015 at 10:57 PM, Charles Johnson [charles@chef.io](mailto:charles@chef.io) wrote:

> There’s some caveats with kitchen-docker. When the cache is cold, things  
> are slow. Once it’s warmed up, things tend to be really fast. In my  
> experience, the first run with kitchen-docker is about the same speed or a  
> bit slower than an equivalent Vagrant run.
> 
> Also, you can’t do your first kitchen run in parallel with a cold  
> boot2docker. The disk usage in the vm tends to increase faster than the  
> guest-disk-auto-resize in virtualbox can manage, and my runs fail as a  
> result. Serialize the first time through.
> 
> All that said, subsequent runs are much, much faster and parallelize no  
> problem.
> 
> My setup:
> 
> - Retina MBP Mid–2012 (Core i7 16GB RAM)
> - OSX 10.10.2
> - boot2docker 1.5.0 (from brew cask)
> - docker 1.5.0 (from brew cask)
> - chefdk 0.4.0
> - VMWare Fusion 7.1.1
> - Vagrant 1.7.2
> - vagrant-vmware-fusion (3.2.0)
> - Have my vagrant box already cached
> 
> Here’s a repo with a very simple recipe, just one template and an  
> attribute feature flag. The repo contains a .kitchen.yml that does 3  
> suites:  
> [https://github.com/charlesjohnson/fundamentals-with-tests/blob/master/chef-repo/cookbooks/motd/.kitchen.yml](https://github.com/charlesjohnson/fundamentals-with-tests/blob/master/chef-repo/cookbooks/motd/.kitchen.yml)
> 
> Here’s my .kitchen.local.yml that I layer in on top of it:
> 
> driver\_plugin: docker  
> driver\_config:  
> provision\_command: curl -L [https://www.opscode.com/chef/install.sh](https://www.opscode.com/chef/install.sh) | bash  
> require\_chef\_omnibus: false  
> use\_sudo: false
> 
> Turning off the require\_chef\_omnibus flag and manually curl-pipe-bash’ing  
> puts the installation of chef-client into its own layer in the docker  
> cache. Slow the first time, zippy as hell afterward.
> 
> Here’s some quick informal benchmarks for those runs, just doing a kitchen  
> destroy; kitchen converge (no busser):
> 
> Kitchen-Docker (cold booted VM, no layers cached at all, no parallel):  
> -----\> Kitchen is finished. (2m38.15s)
> 
> Kitchen-Docker (warm cache, no parallel): -----\> Kitchen is finished.  
> (0m22.73s)
> 
> Kitchen-Docker (warm cache, parallel): -----\> Kitchen is finished.  
> (0m7.02s)
> 
> So by using kitchen-docker I get 8-second kitchen runs, including machine  
> creation from scratch each time. Not bad at all.
> 
> Thanks,  
> --Charles
> 
> _Charles Johnson_ — Product Engineer
> 
> (510) 545-9485 – [http://mailto:charles@getchef.com/](http://mailto:charles@getchef.com/)[charles@chef.io](mailto:charles@chef.io)  
> [charles@opscode.com](mailto:charles@opscode.com) – \*my: \*Linkedin  
> [http://www.linkedin.com/pub/charles-johnson/1/b38/6a5](http://www.linkedin.com/pub/charles-johnson/1/b38/6a5) Twitter  
> [https://twitter.com/chipadeedoodah](https://twitter.com/chipadeedoodah)
> 
> CHEF
> 
> [CHEF.IO](http://CHEF.IO) [http://www.getchef.com/](http://www.getchef.com/)
> 
> TM
> 
> _[chef.io](http://chef.io) [http://www.getchef.com/](http://www.getchef.com/)_[http://www.getchef.com/blog/](http://www.getchef.com/blog/)Blog  
> [http://www.opscode.com/blog/](http://www.opscode.com/blog/) Facebook  
> [https://www.facebook.com/getchefdotcom](https://www.facebook.com/getchefdotcom) Twitter  
> [https://twitter.com/getchefdotcom](https://twitter.com/getchefdotcom) Youtube  
> [https://www.youtube.com/getchef](https://www.youtube.com/getchef)
> 
> On April 4, 2015 at 7:47:45 AM, Jimmy Huang ([jimmy.huang@duragility.com](mailto:jimmy.huang@duragility.com))  
> wrote:
> 
> Hi,
> 
> I am trying out kitchen-docker as a replacement for kitchen-vagrant,  
> hoping to speed up my integration tests. Unfortunately, the tests take ten  
> times as long to run with kitchen-docker compared to kitchen vagrant. I am  
> on test-kitchen 1.3.1 and kitchen-docker 1.7.0. Below is my .kitchen.yml.  
> I used Boot2Docker to install Docker and Vagrant on my machine. Thank you  
> for your help.
> 
> Jimmy
> 
> [https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984](https://mail.google.com/mail/u/0/#inbox?compose=14c84e4a519b2984)
> 
> * * *
> 
> driver:  
> name: docker
> 
> provisioner:  
> name: chef\_zero  
> data\_bags\_path: test/fixtures/data\_bags  
> environments\_path: test/fixtures/environments
> 
> platforms:
> 
> - name: ubuntu-14.04  
> driver\_config:  
> image: ubuntu:14.04  
> container\_name: ubuntu\_test\_1404  
> platform: ubuntu  
> attributes:
> 
> suites:
> 
> - name: stag  
> provisioner:  
> client\_rb:  
> environment: masterwrap-stag  
> run\_list:
> - recipe[masterwrap::default]  
> attributes:
