Openhood

Better network performance in Docker/Test Kitchen with Virtualbox on Mac

Image by by NASA on unsplash

If you’ve experienced really slow downloads from within VirtualBox on Mac, chances are you’re using the default NIC for your NAT interface.

I’ve seen docker‘s pull taking ages when a layer size is more than a couple MB and chef installer taking more than 10mn to download the package…

Here’s how to fix it in docker-machine and test-kitchen.

For docker-machine

Check what’s your docker-machine VM’s name:

docker-machine ls
(out)NAME           ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
(out)default        -        virtualbox   Running   tcp://192.168.99.100:2376           v1.12.5

it can give you different depending of your config.

If it’s Running, then stop it first:

docker-machine stop default

then change the NIC to use the PCnet-FAST III (Am79C973) instead of the default Intel PRO/1000 MT Desktop (82540EM):

VBoxManage modifyvm "default" --nictype1 "Am79C973"

And finally start it, it will now use the new NIC with “hopefully” improved speed:

docker-machine start default

For test-kitchen

Update your kitchen.yml or kitchen.local.yml to have your vagrant driver include the customize config below:

driver:
  name: vagrant
  customize:
    nictype1: "Am79C973"

Enjoy using all your available bandwidth!!

Copyright © 2024 Openhood SARL