Docker and Windows

Docker and Windows

I was recently tasked with helping to architect a workflow using Docker and Containers for a project we are working on. Eventually, this will be part of a CI/CD pipeline. I was honest and I will be honest with you too. I have no prior experience in this subject. Prior to this week I was somewhat familiar with the concept but didn’t really have anything other than a pretty high-level understanding. To throw that in we are also going to be using Docker on a Windows application, so it needs to be run in a Windows container. It seems like in the last couple of years, that Docker for Windows has come a long way, in that it is more friendly with Windows 10 OS, (Pro/Enterprise) and Windows 10 can also run both Linux and Windows containers although not at the same time.

Activate Hyper-V

For the initial install of Docker I used Community Edition here., although there is an Enterprise Edition as well which will most likely be used for our production host environment. After installation, and I am not sure if this was necessary, I also rebooted the machine and made sure that the setting in my BIOS was enabled for CPU Virtualization. Then I ran the Docker CE installer. On reboot of the Machine again I was asked to enable Hyper-V. Running a Linux container on your Windows 10 Machine will utilize this and create a small Linux VM. You can now open up Hyper-V Manager and see a MobyLinux VM, which must be the VM that runs the actual containers hosted by Docker. Pretty neato.

Running Windows Containers

In Windows hidden icons, click the Docker Whale and make sure that Windows Containers is selected. Pretty easy peasy. Following that, I ran through a couple of tutorials. I will say that I am super excited about learning Docker and running applications through containers. Also Dan Whalin has a course on Pluralsight all about Docker for Web Developers that I have also taken and it offers some pretty up to date information, although the Docker Cloud portion is no longer relevant. There was a step by step implementation for getting your docker environment setup as well as how to run Docker containers interactively and building a more complex application and with multiple containers using docker compose. Here is Dan’s github for the course materials and I think you can probably work your way through most of the examples.

Visual Studio 2017 For Development

I have also found that Visual Studio 2017 has some pretty well built in tooling for running ASP.NET applications using docker-compose. Setting up projects just requires you to check off the Enable Docker Compose support box. I am still unsure how to run other applications in a container but I feel like this will be a good starting point.

Another gotcha that I have found that at my work environment versus my home desktop, is I need to explicitly tell Visual Studio and Docker for Windows to run with Administrative privileges. There were a few times that Docker would be not so friendly with my laptop and I would need to stop docker services and start them again using Administrative rights. I ran into this issue that was outlined here as well, but it was resolved once I started running it under administrative privileges.

Anyways, keep me posted, I will be doing a few different posts on Docker as I find working with Containers interesting and want to understand the technology more.

Next On FoC

Review of ‘Grokking Algorithms’

Review of ‘Grokking Algorithms’
Previously On FoC

How to Learn a New Topic Quickly

How to Learn a New Topic Quickly