Alpine Docker-Machine & KVM Driver

Table of Contents

It is easy to install Docker in Alpine as packages are readily available. But what about Docker-Machine without VirtualBox?

Install Docker Machine

Following official instruction work perfectly:

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo install /tmp/docker-machine /usr/local/bin/docker-machine

Check version:

$ docker-machine version
docker-machine version 0.16.0, build 702c267f

Docker KVM Driver

Docker site only give VirtualBox example:

docker-machine create --driver virtualbox myvm

There is a driver list if you dig deeper but none is for KVM. dhiltgen on github created one but stopped maintaining it, and it has issue1 with the latest docker image used by docker machine. The current working driver is from tdilauro’s fork and you can install it as below:

curl -L https://github.com/tdilauro/docker-machine-kvm/releases/download/v0.10.1/docker-machine-driver-kvm-alpine3.4 > /usr/local/bin/docker-machine-driver-kvm

chmod +x /usr/local/bin/docker-machine-driver-kvm

This fork added the --kvm-nic-type option to allow one to specify virtio during the creation process. Then you can create docker machine like this:

docker-machine create --driver kvm --kvm-nic-type virtio myKvm
  1. Original KVM driver issue on github
John Siu
comments powered by Disqus