Building Unikernel with Nanos + Spring-boot App and deploy on AWS Cloud

This post is a demonstration of running Nanos in MacOS and creating a unikernel with spring-boot application to deploy on aws cloud. I’ll not get into a concepts or architecture here. Please read my previously post “The death of Linux Containers” if you are looking for knowledge about Unikernels.

“Nanos is a new kernel designed to run one and onlyone application in a virtualized environment. It has several constraints on it compared to a general purpose operating system such as Windows or Linux — namely it’s a single process system with no support for running multiple programs nor does it have the concept of users or remote administration via ssh.”

So, let’s put the hands on the keyboard.


You need Homebrew, AWS cli, JDK8 and Maven installed on your MacOS.


There are following dependencies should be installed before build Nanos.

Note: You will face a qemu problem when trying to compile Nanos because the MacOS has made changes to the hypervisor entitlements. The error is look like this:

To be more specific, the entitlement (used in macOS 10.15) has been deprecated and replaced by

To fix that, create an xml file named entitlements.xml with this content:

Then sign the qemu binary with it:

And that is it, the qemu will work and able to launch VMs.

Building Nanos

Run the following command:

The output will be something like this:

As you can see, the build was successful and the Nanos was loaded, the listen port is 8080, it is possible to access through telnet for testing. Than press control+c to stop running.

The first part it is done! Now you have Nanos able to create images. The next step will show how to manage the images with OPS.

Installing OPS

Ops is a tool for creating and running a Nanos unikernel. It is used to package, create and run your application as a nanos unikernel instance.

Run the following command to install OPS.

Ok, now we have ops installed and Nanos built from MacOS.

Building images

I have the repository with a spring-boot application here:

Please take a look at file config.json :

Here is the configuration for ops to create the image wrapped with your application inside. The “CloudConfig” is the setup to send the image through AWS cli.

Build aws image

Make sure you have ~/.aws/credentials and ~/.aws/config are setup properly.

First of all, you need to create the S3 bucket with the same name and region found on config.json

Than create the image for aws like below:

The command will upload the image to the cloud automatically. This will take a time to finish the setup. We can see the output here:

Than we could check the image with the next command:

Now we are prepared to create the instance on aws cloud.

Than we could check the running instance on aws with the following commands:

To delete the instances from aws and locally, we could run the commands:


Nanos has other packages to build many different images, like C, Java, Node, Python, Go, etc. But I choose Java + spring-boot for this POC; Nanos is very fast to create an image; it takes less than 2 seconds, it’s very impressive. The pre-built packages for each programing language are the key that allows the incredible velocity of building images.

The ops program is very useful, and it has a lot of commands that make management very easy. It looks like a docker command-line tool.

That is it for today. I hope this POC give some insights to you, like creating a CI/CD script to deploy your apps.

This is my contribution, stay close to see the next posts.


Originally published at on May 2, 2021.

Impulsionar pessoas para inovar o mundo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store