Reading Time: 4 minutes

Recently I have been learning a lot about Docker from the amazing Nigel Poulton and his courses on Pluralsight. So to help me remember what I am learning and to hopefully help someone else out I thought I would create some blog posts about Docker. I already have one about Linux containers on Windows Server 2016 1709 which you can read here.

In this article, I am going to walk through preparing your Windows 10 computer ready to install Docker. Downloading and installing Docker, switching the Docker Daemon to Windows Containers, running a Windows Server Container and finally as an added bonus enabling PowerShell tab complete!

Preparing your Computer

Before we can install Docker we need to make sure our computer is compatible with running Hyper-V. Once we have figured out that our computer can run Hyper-V we have to install it. This can be done from an elevated PowerShell window with the following command.

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

Hyper-V is now installed but we need to reboot our computer to enable it. Once the reboot has completed we are ready to install Docker.

Installing Docker

Download Docker from the Docker website. Here is a link to the Stable Windows 10 version

You can go here to find more information and the edge version.

Once downloaded run the installer.

It will download some files and then unpack them.

Once finished click the Close and Logout button

Once you log back in Docker will take a while to start. When started a window will pop up to let you know Docker is now up and running.

You have now installed Docker on windows 10. Feel free to sign in or create an account at this stage.

Using Docker

Now that we have Docker Installed we can start to use it. The best way to work with Docker on Windows 10 is via PowerShell.

Lets check what version of Docker we have installed.

Open up PowerShell with elevated permissions and type the following.

Docker version

You may have noticed that by default we are able to run Linux containers. (look under the Server OS/Arch section above)

To enable Windows containers we can use the following command.

& "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon

You can see in the above image that I have run Docker Version again. After running the above command the Server OS/Arch has been changed to Windows. To change back to Linux just run the above command again.

Now that we have switched to Windows Containers, we are able to create our first Windows Nano Server Container. This is done by using the following command in the Elevated PowerShell window.

Docker run microsoft/nanoserver

To see if the container was created we can use the following command

Docker ps -a

Bonus

Install PowerShell tab Complete

To enable PowerShell tab complete we can use a PowerShell module called posh-docker. This can be installed using an Elevated PowerShell window and the following Command.

Install-Module posh-docker

Now we can import the module so it is available to us. To do this use the following PowerShell command.

Import-Module posh-docker

Tab completion should now work for you. But wait you can also make this persistent over all your PowerShell sessions by adding it to your profile. To do this just use the following PowerShell Command.

if (-Not (Test-Path $PROFILE)) {
New-Item $PROFILE -Type File -Force
}
Add-Content $PROFILE "`nImport-Module posh-docker"

And that’s it. You have installed Docker on Windows 10, Change the Docker Daemon to Windows Containers, Ran our First Windows Container and as an added bonus enabled tab completion for Docker commands.

I hope you found this article helpful. If you have any questions please leave a comment below.


Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *