Want to run Docker containers on your Windows 10 Pro machine? Very easy, just install Docker for Windows and start build, ship and run containerized apps right there on your Windows 10 PC.
Docker comes with two editions, which are the Enterprise Edition (EE) which is designed for enterprise development in production and at large scale, and the Community Edition (CE) which is intended to be used by individual developers to experiment and testing purpose.
The thing with Docker, regardless of which edition you’re using, is that if your container runs and passes all your crazy tests on your development machine, then it will run anywhere else with no changes needed to be done. As such, you do have the possibility to move your containerized app from your own machine to any destination server, should be on-premise or in the cloud, without affecting the underlying code, and that’s the base model of DevOps, which allows you to deploy your infrastructure without giving much importance to the applications that will run on top of it. You deploy your infrastructure separately from your applications, and you manage them separately as well.
In this post, we will go through the steps to install and use Docker Desktop Community Edition (CE) in Windows 10 Pro. Docker Desktop is an easy-to-install application for your Mac or Windows environment that enables you to start containerizing your application in a very easy manner
Consider this before Installation
If not previously installed, Docker for Windows will install and run Hyper-V on your Windows 10 as it is a required component. If you’re using any virtualization platform like VMware Workstation or Oracle VM Virtualbox, this will cause these programs to stop working. Your previously created VMs will still be there but you will not be able to start them using these hypervisors. This might not be a big deal for you since you can always use a conversion tool like Microsoft Virtual Machine Converter (MVMC) to convert your VMs to be used in Hyper-V. Having said that, prevention is better than cure.
Installing Docker for Windows on Windows 10 Pro
Checking the Prerequisites
- Virtualization must be enabled. To check this, launch the Task Manager and click on the CPU pane from the Performance tab.
If virtualization is not enabled on your system, check your BIOS manufacturer user guide on how to do it.
- Requires Microsoft Windows 10 Professional or Enterprise 64-bit. Check your system properties to know if your system is a 64-bit.
If you are running a Windows Home, a 32-bits system or a prior version of Windows, consider using Docker Toolbox instead.
Downloading Docker for Windows
Docker Desktop is available for Windows and for Mac. Click on Download Docker for Windows.
You will then be redirected to the Docker Community Edition for Windows. Click on Get Docker and save the file.
Installing Docker for Windows
Double-click InstallDocker.msi to run the installer and follow the instruction steps.
Because Docker does not start automatically after you log in, you will need to start it from the Start menu and make sure you do it as Administrator because privileged access is needed to install networking components, Containers capabilities and Hyper-V VMs.
You will need to click on OK to install the required features. your machine will be restarted after the installation.
In the background, Hyper-V has been installed and a VM called MobyLinuxVM has been created and started. Your Linux containers run inside this Linux thin VM that runs within Hyper-V on your Windows 10 machine.
After some time, you will see the whale in the status bar turns to steady state. That means that Docker is up-and-running, and accessible from any terminal window, like PowerShell or CMD.
When everything is started and initialized, you will get a popup success message with suggested next steps, and a link to the official documentation.
Congratulations! You are now ready to run container with Docker for Windows on your Windows 10 Pro machine.
What Really Happened in the Background?
Docker for Windows is using Hyper-V to run the Moby VM, based on toolkit called LinuxKit to run Linux images. LinuxKit provides a container based Linux OS. Consequently, and because we are on Windows 10 machine, Hyper-v has been installed and the Moby VM was created and started to run Linux containers on Windows.
On the other hand, Windows Server Containers run Windows binaries on the same host OS, similar to how Linux containers run on a Linux OS, so they do not need the Moby VM. To run Windows containers on a Windows host, the Containers has also been installed.
You can confirm that these functionalities have effectively been installed by checking the Windows features installed on your system on Control Panel > Programs > Programs and Features > Turn Windows features on or off.
Creating Docker Containers in Windows
Now that Docker is installed, you will be able to run containers by running a terminal tool (Command Prompt or PowerShell). You can start by getting some useful information about the Docker version installed with the following command:
PS C:\Users\Admin> docker info
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Windows
Total Memory: 1.934GiB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
System Time: 2018-09-18T11:50:11.6598517Z
Live Restore Enabled: false
Let’s try to deploy Azure Command Line runtime with a Docker container. The Azure CLI is Microsoft’s cross-platform command-line experience for managing Azure resources, that can be installed on Windows, Linux and MacOS. After which, you would be able to manage Azure resources through command-line.
However, by deploying a Docker Azure CLI container, we will be able to run those commands with no install on the host system. Let’s go ahead.
PS C:\Users\Admin> docker run -it microsoft/azure-cli
Unable to find image 'microsoft/azure-cli:latest' locally
latest: Pulling from microsoft/azure-cli
ff3a5c916c92: Pull complete
471170bb1257: Pull complete
d487cc70216e: Pull complete
9358b3ca3321: Pull complete
d4d73eb5841d: Pull complete
c29a115ea3a9: Pull complete
180e806cd519: Pull complete
41c418a74f6d: Pull complete
Status: Downloaded newer image for microsoft/azure-cli:latest
Because the image was not available in the host’s local registry, Docker went ahead and pulled the image form the Docker Hub then started the container.
There you have it! Your azure cli container is up and running. You can manage you Azure workloads as if you had Azure CLI installed locally on your machine.
/ \ _____ _ _ ___ _
/ /\ \ |_ / | | | \'__/ _\
/ ____ \ / /| |_| | | | __/
/_/ \_\/___|\__,_|_| \___|
Welcome to the cool new Azure CLI!
Use `az --version` to display the current version.
Here are the base commands:
account : Manage Azure subscription information.
acr : Manage Azure Container Registries for private registries within Azure.
acs : Manage Azure Container Services.
ad : Manage Azure Active Directory Graph entities needed for Role Based Access
advisor : Manage Azure Advisor.
aks : Manage Azure Kubernetes Services.
ams : Manage Azure Media Services resources.
Docker is a great and easy to learn platform to create containerized apps, and Docker for Windows is the best way to get started with Docker on you Windows 10 Pro machine.