Docker on Windows 10 - Introduction guide


Updated: August 12, 2016

Docker has been riding the media wave for some time now, most masterfully managing the crests and dips of the tech ocean, providing an excellent balance between technology, service, business, and accessibility to those lusting for the new rave of containers. In a way, it has become synonymous with the latter, and recently, it's stepped even deeper into the commercial world by offering orchestration mechanisms that companies crave. Indeed, so what's the next logical step? Windows.

Having a container mechanism that also works in Windows guarantees more attention, more serious, grown-up, adult attention from businesses and enterprises, especially if they cannot commit to the cloud or Linux journey that easily. Which is why Docker is now also available as a beta demonstrator both on the Windows server and client editions. This article is an intro guide for getting started with Docker in the Microsoft world.

First steps, prerequisites

There are several things you should take into consideration. One, Docker is Docker. If you are familiar with the framework and basic usage, then all you need is to get the containers running in Windows. If you need help, please consult my thorough guide on how to use Docker. Originally written for Linux, the commands fully apply here. While you're busy reading, you might also want to check my supervisord and networking tutorials, too. Soon, we will also have a new, refreshed article on Docker's latest capabilities and features, but that is a topic for another time.

Two, Docker requires Hyper-V to run natively on your system. This means 64-bit pro or server edition of Windows 10. In my case, I only have a Home version available, which is why I will test Docker Toolbox, an edition designed to work around the limitations of native support by running a headless VirtualBox engine in the background.

Hyper-V not available

The Toolbox edition is fairly simple to setup. Once you install it, you will have a quickstart option available in the system menu, which will prep the environment, configure SSH keys and a few other details. This is somewhat - rather unsurprisingly - similar to what we did when setting up Vagrant a while ago.

Toolbox

Docker guys really have a knack for attention to detail - including logos. This is why they will get bought one day
and make a staggering amount of money by making an existing technology more accessible to the masses. Magic.

Toolbox setup

Toolbox installing

Env prep

The setup may take a while, and it is quite IO-intensive. Let it complete, and then you will have your shell, in which you can run Docker commands just as you would on a typical Linux box. More about that in a jiffy.

Disk busy

Shell, ready

Manual service configuration & errors

You might be tempted to just run Powershell and hammer down Docker commands. Unfortunately, this will not work, unless you have the Docker service installed. This can be done, however, the service will fail to start unless you run a Windows Server edition. In more detail, here's how you do that, or rather, not.

Powershell prompt

The next logical step, after firing up command line is to try to pull down an image, but this will result in a big and ugly error. As I've briefly mentioned earlier, the reason is, the service is not natively installed.

PS C:\Users\Roger Bodger> docker pull centos:7
Warning: failed to get default registry endpoint from daemon (An error occurred trying to connect: Get http://%2F%2F.%2F
pipe%2Fdocker_engine/v1.23/info: open //./pipe/docker_engine: The system cannot find the file specified.). Using system default: https://index.docker.io/v1/
An error occurred trying to connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/images/create?
fromImage=centos%3A7: open //./pipe/docker_engine: The system cannot find the file specified.

You may try to resolve this by searching for the error message online and configuring the daemon yourself. This exercise will work, except the last step. If you try to start the Docker service, it will fail.

Download daemon manually

Service registered

PS C:\Program Files\docker> Start-Service docker
Start-Service : Failed to start service 'Docker Engine (docker)'.
At line:1 char:1
+ Start-Service docker
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (System.ServiceProcess.
                          ServiceController:
                          SeCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.
                          PowerShell.Commands.Star

Cannot start service

The reason is quite simple (from the Event Log):

fatal: Error starting daemon: The Windows daemon requires Windows Server 2016 Technical Preview 5 build 14300 or later

Using Docker on Windows 10

Now the fun part. The usage model is identical to what I've taught you in the past. The new version of Docker does include extra commands and features that I have not reviewed yet, but the rest of it works perfectly. Just follow the tutorial and you will have your instances up and running within seconds, including containerized Apache and ssh and whatnot. From this point on, Bob's your uncle.

Pull image

Container launched

Docker running

Conclusion

I am pleased with the Windows port, both the native implementation and the toolbox, as it allows more people to try and explore Docker. Having tested only the latter, I can report that it does as advertised. The framework behaved well, it run fast and without any big overhead, and I did not encounter any big issues or bugs or errors.

In essence, it's the same old Docker we know, and that's the beauty of it. If it runs the same on Windows as it does on Linux, it gives serious users a real incentive to develop cross-platform applications that won't break moving between operating systems. Well, that is the theory at least. We all know that 99% of all software out there is designed to run single-threaded, and that the concept of containers still has a long, long way to go before it becomes a reality for any serious application use. But at the very least, the Docker guys are really helping on this journey, and the Windows 10 enablement is another cool feature in a long string of their successes. I like. And I'm going to explore more and come back with a handful of new and exciting buzzwords, as well as tutorials. See ya.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate