Skip to main content

Technology Preview: CoreOS Linux and xhyve

Yesterday a new lightweight hypervisor for OS X was released called xhyve; if you are familiar with qemu-kvm on Linux, it provides a roughly similar experience. In this post we are going to show how to run CoreOS Linux under xhyve. While this is all very early and potentially buggy tech, we want to give you some tips on how to try CoreOS Linux with xhyve and run Docker or rkt on top.

xyhve is a port of bhyve, the FreeBSD hypervisor, to OS X. It is designed to run off-the-shelf Linux distros. We’ve made it possible to run it on CoreOS Linux so you can get the benefits of a lightweight Linux OS running under a lightweight hypervisor on Macs. It is now possible to launch a full local development or testing environment with just a few shell commands.

A few ideas we are thinking about:

  • Single command to launch CoreOS Linux images.
  • Easily launch a Kubernetes cluster right on your laptop.
  • An OS X native version of rkt that can run Linux applications inside xhyve.

Keep in mind that xhyve is a very new project, so much work still needs to be done. You must be running OS X Yosemite for this to work. Check out this page for step-by-step instructions on how to try it out.

A Quick Example

Currently, you need to build xhyve yourself:

$ git clone https://github.com/mist64/xhyve
$ cd xhyve
$ make
$ sudo cp build/xhyve /usr/local/bin/

Now we can install the initial CoreOS tooling for xhyve:

$ git clone https://github.com/coreos/coreos-xhyve.git
$ cd coreos-xhyve
$ ./coreos-xhyve-fetch
$ sudo ./coreos-xhyve-run

Type ip a in the console of the virtual machine to get its IP address.

Let’s run a simple Docker container:

$ docker -H<ip-of-virtual-machine>:2375 run -it --rm busybox

Please open issues with ideas for enhancements or use cases. We welcome contributions to the code, so please open a pull request if you have code to share.