Now that you’re sold on the idea of Docker, let’s figure out how you can get the ball rolling. The following four things are required before we even touch a line of code:
- Virtualization is enabled on your machine
- Hyper-V
- Docker for Windows
- A couple shots of Crown Royal. It’s Canadian, so you know it’s nice.
#1 Virtualization enabled on your machine
So this one is a little harder than the following ones, because you’re possibly going to head into the world of the BIOS. It’s usually scary. Mostly because your mouse doesn’t work here, and you have to tab and arrow key around like a savage. First, you’re going to want to check that Virtualization isn’t already enabled. Run Task Manager, and click over to the “Performance” tab. If you don’t see that tab, you’re not a real developer. In order to be a real developer, click the “More Details” button at the bottom.
So now that you’re on the Performance tab, look down. See the circle? That should say “Enabled” like mine does.
If your Virtualization says “Disabled” you need to reboot your computer (wait) and find the BIOS setting that controls Virtualization. It goes by a few different names such as “Virtualization”, “VT-x”, or “Intel Virtual Technology”. (The last sentence there is gonna do wonders for SEO, y’all….). So reboot your machine, mash the F12, Enter, Escape, F2 or Del key until your keyboard beeps. Then watch that it was some random other key, hit the power button, and try to get into your BIOS again. Once successful, save your change, exit, confirm exit, and get back into Windows. Check your Task Manager again, validate Virtualization is Enabled, and move on.
#2 – Hyper-V
This section is a LOT easier than the previous. The first one kinda thins the herd a bit. Those not willing to don a reboot aren’t worthy of the majestic Docker Containers. You are, though. We’re going to ensure Hyper-V is installed. Go ahead and launch the “Turn Windows Features On or Off” tool and check it for Hyper V. See it there? I have it!
If you don’t see the fancy check box, go ahead and install it. It shouldn’t be too painful. Not nearly as bad as #1 anyway. There’s a joke in there I’m not gonna make.
#3 – Docker for Windows
This one should also be pretty simple. You may be asking yourself “Hey Rob, doesn’t Docker for Windows install Hyper-V for me?” Well yeah. But then my list would only have two items. That’s not a list, yo. But you’re here now. That’s in the past.
Anyway, head over to the Docker Website and to the Docker for Windows download page. Download it, install it. You may have to reboot. I’ll wait. OK, you’ve got it now? Great. Open up a command prompt and type
docker --version
You should be greeted with a response like “Docker version 19.03.2, build 6a30dfc“. If you’re greeted with something like “dicker : The term ‘dicker’ is not recognized as the name of a cmdlet, function, script file, or operable program.” then you’ve misspelled ‘docker’ because you have questionable search habits. Probably.
OK, one last thing. We’re going to be using Windows containers. Docker does both Linux and Windows containers, but for the sake of simplicity and to lower the barrier to entry, we’re doing this via Windows. We need to swap Docker over to Windows Mode, since it defaults to Linux. Right click the Docker Icon in the System Tray. It you should see this:
Docker tells you it may be a second. And it’s not lying. There’s some voodoo crap going on right now and honestly, you probably don’t want to know.
Next in this step, we need to tell docker how to use DNS. Out of the box, you don’t get any DNS information. Which is not fun, and will lead to other issues down the road. Go ahead and open C:\ProgramData\Docker\config\daemon.json. You probably see this:
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": false
}
We’re going to append a line here and give it some DNS by making your file look like this:
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": true,
"dns": ["8.8.8.8","4.4.4.4"]
}
Make sure you restart the Docker Desktop (right click the system tray and hit “Restart…”).
Anyway, time to move on to #4.
#4 – Crown Royal
I guess it’s not technically required, but if you’re up for it, why not? If you don’t drink alcohol, I understand. I probably shouldn’t either. For you, there’s Labatt Blue. It’s also from Canada, but I’m pretty sure there’s no real alcohol in it.
Joking aside, if you’ve made it this far, congrats. You’re ready to move into the yummy world of layers in the aptly named: Part 3: Layers are Yum.
This is a post in the “Yet Another Sitecore Docker Series.” Other Posts include
- Part 1: The Beginning
- Part 2: Running Docker
- Part 3: Layers are Yum
- Part 4: Composing an Image
- Part 5: Deconstructing a Dockerfile
- Part 6: Simply Solr
- Part 7: Smooth as SQL
- Part 8: It’s Sitecore Time
- Part 9: Compose all the Things