Thursday, 23 March 2017

An Introduction to Conatiners and Docker: Switch to Windows Containers

This is Chris Gibson's second post. This post follows on from his first post called: An Introduction to Containers and Docker. You can read all about Chris on our About Us Page


Introduction

So far you have a fresh install of Docker for Windows, which is cool.  However, by default Docker installs a Linux VM to run your containers.  You want to run Windows containers so need to change this.  Luckily Docker makes this easy, but with one potential gotcha.

Locate the Docker icon in the system tray and right click - you will see an option in the menu labelled “Switch to Windows Containers...”





Once you click this, Docker will start the switching process and you will see a “Docker is switching…” message pop up.


After a few moments, Docker will prompt you to enable the Windows Container feature.  Click ok, wait for the install and automated reboot.


When you next log in, Docker will start as normal and you should be all ready to start playing with Windows Containers right? Nope. If you open a PowerShell prompt as Administrator and run the Docker Version command again, you will see that the server “OS/Arch” is still set to “linux/amd64”.  This happens because Docker needs the Container feature installed before it can switch to it.

If you go back to the Docker menu, it will still show the message “Switch to Windows Containers…”.  

Follow the process again and after a while you should get the “Docker is running” pop-up.  To make sure it has switched you can check the Docker Menu - it should look like this:




You can also run the Docker Version command and see the Server “OS/Arch” value, which now shows “windows/amd64”

Now you’re ready to run Windows Containers, which we look at in the next post.

No comments:

Post a Comment