Running Linux on Windows
Running Linux on Windows
We brought Nanos unikernels to Microsoft Azure, so you can run Linux applications faster and safer. Plus, you can run them on your Windows desktop and Hyper-V!
Join the DZone community and get the full member experience.Join For Free
If Steve Ballmer were dead he'd be rolling in his grave right now. That's right - we brought Nanos unikernels to Microsoft Azure which means that you can now run Linux applications faster and safer than Linux itself on Azure of all things! Oh yeh - side benefit is that you can now run Linux applications on your Windows desktop as well through Hyper-V.
Ready to run your first application? Great!
Azure is not so straight-forward as other cloud platforms to deploy to mainly because there are so many other environment variables that need to be set and the deploys can take a lot longer than something like Google Cloud, but once you get going it's super fast. In my tests (from Oakland) my latency is insanely good in comparison to other providers. I might disagree with some of the complexity of the Azure environment but the documentation has maintained its reputation from when I was in school (so many decades ago). Azure also has little niceties like being able to pop ports without taking down an instance.
If you don't have the az cli tools they are worth downloading first - for this example you kinda need to. You'll want to create a new resource group and storage account, which we'll use as a cloud bucket. Inside the storage account, don't forget to set up a container to store your vhdx blobs in.
Next, let's create a quickstart authorization account:
This dumps a ton of authentication env vars into a JSON payload. We'll be using these for almost all of our operations so in the examples below just cut/paste them.
Create an Image
Now we'll create an image. Out of all the clouds, Google Cloud might be the quickest to deploy to while Azure is the longest. However, as you'll soon see Azure is fairly fast one your instance is booted.
What this command does is take the disk image you created, convert it to a vhdx, which should be sized correctly, and has a minimum of ~20mb, then uploads it to your cloud storage container.
Deploying an Image
Next, let's deploy the image you just created. As of right now this command never really finishes as Azure is expecting to install a user account with a password or ssh key but unikernels don't have user accounts nor do they have ssh and passwords just don't exist. The reason is that it's just running one application. If anyone from Microsoft/Azure is reading - we're hoping this might be tweaked in the future. Azure isn't the only platform that expects this, Alibaba Cloud has the same expectation, but neither AWS nor Google Cloud seems to care. It's a minor annoyance but not insurmountable as you'll see:
After a few minutes you'll see your instance will appear by running the instances list command:
Just like in ESX we attach a serial adapter to the instance and the logs are automatically routed to text files for you. This is actually a fairly nice feature of Azure as they give you the textual logs and also take graphical snapshots for you. I was pleasantly surprised to see this just work out of the box:
For production applications, you'll obviously want to route these logs to Splunk or elastic search or whatever log solution you are using.
After you are done playing around you can delete the image like so:
There is plenty of more integration work that we can do for Azure so if you are a big Azure user definitely check out the OPS repo -- we also accept pull requests!
It just might finally be the year of Linux on the desktop - well at least on the windows desktop!
Opinions expressed by DZone contributors are their own.