Finally Docker comes to Windows
In these days, and after 5 years of development (test and beta included), windows server 2016 GA is available for download. One of the coolest staff of this release is the native docker engine under the OS. Yes!!! containers could run natively on Windows system. In this post I’ll show you a test under my laptop (God bless the SSD and 12 GB RAM).
Before this release (a real milestone in docker lifecycle), the admitted way to use container under Windows were:
- docker-machine with boot2docker VM under VirtualBox
- docker-machine with boot2docker VM under HyperV (the new toolbox)
Obviously run in a VM under your laptop is for development purpose but the thing that a windows dev was unable to do is make a real windows container: like an IIS, SQL server, etc. The tier-1 lover could object about the needs to have a containerized SQL instance, but thinking about resiliency and security, you could consider containers the best technology to develop your applications. (Tier-1 lover: please update your knowledge)
Now, dear windows devs: you could use a gold chair as well as linux dev one year before, and become a fully devops without compromises.
Going ahead…
Now, following the Andrea’s guide ( http://vinfrastructure.it/it/2016/10/windows-server-2016-con-supporto-docker-e-ga/ ) download the Windows server ISO file and test under my VMware workstation. Hint: Because is an evaluation, during VM creation, you should follow the classic installation method (install OS late).
NOTE: Before go through container and other configurations, DO A LIVE UPDATE! This is mandatory to don’t make you crazy in the next steps.
Adding a Feature following “Add Roles and Feature” Wizard,
you should check “Container” under Feature do reboot and at the end you should able to install docker.
Following msdn at: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/deployment/deployment , you should able to:
- download docker and install it.
- configure path and service to start on boot
- configure networking part to enable the remote control
Note: You could follow the official Docker guide too that is quite the same: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/
Start Docker and Run Windows Container
After docker installation you should register as a windows service and you could play with you first container: an IIS container! There are more things to know before start using container:
- consider that in dockerHub registry you could find Windows container images (like IIS : https://hub.docker.com/r/microsoft/iis/)
- in this container host you could run only this last kind: don’t try to run a linux container under this (or viceversa) otherwise a nice error message will appear
- pay attention about disk consumption:
docker run -p 80:80 microsoft/iis
Open the web page e see what’s happens http://<yourvmip> :
Remote docker management
Using docker toolbox under windows 10 or mac, you should able to connect with any local and remote docker host. The use of client certificate is mandatory when you ops your docker host in production environment, but in for sample purpose I’ll show you only how to enable remote management.
Enable firewall ports 2375(insecure) and 2376(secure):
1 |
netsh advfirewall firewall add rule name="Docker daemon " dir=in action=allow protocol=TCP localport=2375 |
Create daemon.json c:/ProgramData/docker/config/ and config options
1 2 |
new-item -Type File c:\ProgramData\docker\config\daemon.json Add-Content 'c:\programdata\docker\config\daemon.json' '{ "hosts": ["tcp://0.0.0.0:2375", "npipe://"] }' |
Restart the service and try to connect with local toolbox:
Another cool staff in this scenario is the ability to handle docker environments directly from Visual Studio. Check this link: https://visualstudiogallery.msdn.microsoft.com/0f5b2caa-ea00-41c8-b8a2-058c7da0b3e4
More announcements may be happens during these days… k.i.t.