Monday, June 20, 2016

Windows Server 2016 Containers: Dockerd can't create a network

What are Containers?
Containers are pretty cool things, basically a virtual machine, but smaller and also faster deploy-able. You can run an application in your container, f.ex. a web application. If this application is buggy, unstable or has any other issue at all, only this container would be affected, not your host system und not other system. Kinda like a virtual machine, but munch smaller. Virtual Machines are normally used to host powerful web servers with multiple applications on it. Containers on the other hand are used for only one application at a time.
You can find more information over here: About Windows Containers
Also here's a link to a way longer explanation: Containers: Docker, Windows and Trends

Get Started!
To get started I followed the QuickStart Instructions (2 - Windows Server Quick Start) and everything went well until I was trying to register dockerd as a service (dockerd --register-service). It failed and I was not able to get why, because I followed the instructions, which are really easy. So instead of running it as a service, I thought that I could simply run dockerd when ever I need it. You know, just as a work-around. Well, that didn't work either, because I ran into a new error (Docker wasn't able to create a network). After a while I decided that I don't care about the network, I only wanted to try containers, so instead of running the dockerd as a service I ran this command.
In my Azure environment I had to run this script as an admin, but to keep it shorter and because I'm lazy this script will start a new PowerShell Window as an admin and will run the command 'dockerd -b "none"'. This will start the Docker Daemon without any network shenanigans. In some versions of Docker might happen that this command creates a bridge called "none".
The Docker Daemon will start, you will have to keep the PowerShell Windows running this command open. If you close it, you will not be able to use commands such as "docker images" or "docker search".
Aside from that issue, containers looks pretty cool. Hopefully I can get it for my Windows 10 very soon. Currently it's only available as an Windows 10 Insider Build (14352 and up) and in Windows Server 2016 Technical Preview 5.

Wednesday, June 15, 2016

Hyper-V: No Internet access in a virtual machine

I was trying to install a small development environment on my Surface Book and of course I wanted to use Hyper-V for that. I got Windows Server 2012 and a SQL Server 2014 setup in no time and was actually surprised how well the virtual machine was running... Until I wanted to install the SharePoint PreReqs and realized I had no Internet access. I hope someday, virtualization software will come with one simple button: "Share Internet from Host? Yes/No". But until then, we will always have to work around some restrictions. Those restrictions make sense in a business / company sense, but not for small development environments on notebooks.

So here's how you will get Internet access!
1. Open your Hyper-V Manager
2. Go to the Actions pane and select Virtual Switch Manager
3. Select an existing switch or create a new virtual switch
4. I you created a new switch, choose a name. In any case you will have to select External network under Connection type. Save your changes!
5. Go back to your Hyper-V Manager and select your VM. Change the Network Adapter to your newly created switch and your done!