This blog is the first part of a multi-part series. The first part showed how to set up Windows Server 2016 as a VirtualBox VM. This second part will show how to configure Docker on Windows 2016 VM.
- Start an elevated PowerShell session:
- Run the script to install Docker:
12345Install-Module -Name DockerMsftProvider -Repository PSGallery -ForceInstall-Package -Name docker -ProviderName DockerMsftProviderRestart-Computer -Force
The VM needs to be restarted in order for the containers to be enabled. Refer to Container Host Deployment – Windows Server for more detailed instructions.
- The VM reboots. Start a PowerShell and check Docker version using
docker version
command:More details about Docker can be found using thedocker info
command: - Run your first Docker container using the
docker run -it -p 80:80 microsoft/iis
command:This will download the Microsoft IIS server Docker image. This is going to take a while so please be patient! - Once the 8.9 GB image is downloaded (after a while), the IIS server is started for you. Check the list of images using the
docker images
command and the list of running containers using thedocker ps
command:More details about the container can be found using thedocker inspect
command:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186[{"Id": "c15555e4b60ec24bbad2b8834c82e14313d193e07da2ca7d3948802e36f4d828","Created": "2016-10-27T23:45:20.4069634Z","Path": "C:\\ServiceMonitor.exe","Args": ["w3svc"],"State": {"Status": "running","Running": true,"Paused": false,"Restarting": false,"OOMKilled": false,"Dead": false,"Pid": 4228,"ExitCode": 0,"Error": "","StartedAt": "2016-10-27T23:45:34.5990616Z","FinishedAt": "0001-01-01T00:00:00Z"},"Image": "sha256:b6a44de60ef92f9eceb68effcfc5fdbd5ecb53677e8c4f1e8dcd02b0c11cb760","ResolvConfPath": "","HostnamePath": "","HostsPath": "","LogPath": "C:\\ProgramData\\docker\\containers\\c15555e4b60ec24bbad2b8834c82e14313d193e07da2ca7d3948802e36f4d828\\c15555e4b60ec24bbad2b8834c82e14313d193e07da2ca7d3948802e36f4d828-json.log","Name": "/cocky_mahavira","RestartCount": 0,"Driver": "windowsfilter","MountLabel": "","ProcessLabel": "","AppArmorProfile": "","ExecIDs": null,"HostConfig": {"Binds": null,"ContainerIDFile": "","LogConfig": {"Type": "json-file","Config": {}},"NetworkMode": "default","PortBindings": {"80/tcp": [{"HostIp": "","HostPort": "80"}]},"RestartPolicy": {"Name": "no","MaximumRetryCount": 0},"AutoRemove": false,"VolumeDriver": "","VolumesFrom": null,"CapAdd": null,"CapDrop": null,"Dns": [],"DnsOptions": [],"DnsSearch": [],"ExtraHosts": null,"GroupAdd": null,"IpcMode": "","Cgroup": "","Links": null,"OomScoreAdj": 0,"PidMode": "","Privileged": false,"PublishAllPorts": false,"ReadonlyRootfs": false,"SecurityOpt": null,"UTSMode": "","UsernsMode": "","ShmSize": 0,"ConsoleSize": [50,120],"Isolation": "process","CpuShares": 0,"Memory": 0,"CgroupParent": "","BlkioWeight": 0,"BlkioWeightDevice": null,"BlkioDeviceReadBps": null,"BlkioDeviceWriteBps": null,"BlkioDeviceReadIOps": null,"BlkioDeviceWriteIOps": null,"CpuPeriod": 0,"CpuQuota": 0,"CpusetCpus": "","CpusetMems": "","Devices": [],"DiskQuota": 0,"KernelMemory": 0,"MemoryReservation": 0,"MemorySwap": 0,"MemorySwappiness": -1,"OomKillDisable": false,"PidsLimit": 0,"Ulimits": null,"CpuCount": 0,"CpuPercent": 0,"IOMaximumIOps": 0,"IOMaximumBandwidth": 0},"GraphDriver": {"Name": "windowsfilter","Data": {"dir": "C:\\ProgramData\\docker\\windowsfilter\\c15555e4b60ec24bbad2b8834c82e14313d193e07da2ca7d3948802e36f4d828"}},"Mounts": [],"Config": {"Hostname": "c15555e4b60e","Domainname": "","User": "","AttachStdin": true,"AttachStdout": true,"AttachStderr": true,"ExposedPorts": {"80/tcp": {}},"Tty": true,"OpenStdin": true,"StdinOnce": true,"Env": null,"Cmd": null,"ArgsEscaped": true,"Image": "microsoft/iis","Volumes": null,"WorkingDir": "","Entrypoint": ["C:\\ServiceMonitor.exe","w3svc"],"OnBuild": null,"Labels": {}},"NetworkSettings": {"Bridge": "","SandboxID": "b23c5766990bb9373e6cbb69cb54b011f57974ed381e60c1eacb7c3c47e303b2","HairpinMode": false,"LinkLocalIPv6Address": "","LinkLocalIPv6PrefixLen": 0,"Ports": {"80/tcp": [{"HostIp": "0.0.0.0","HostPort": "80"}]},"SandboxKey": "b23c5766990b","SecondaryIPAddresses": null,"SecondaryIPv6Addresses": null,"EndpointID": "","Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"IPAddress": "","IPPrefixLen": 0,"IPv6Gateway": "","MacAddress": "","Networks": {"nat": {"IPAMConfig": null,"Links": null,"Aliases": null,"NetworkID": "9ae352610731342dde19246e759944e79af7a19077d879024a17cedca4b061c9","EndpointID": "198d0a52838f1e5178b3fedc154e9f18409c13f0de489e99c06faf9ed2fbedd9","Gateway": "","IPAddress": "172.26.192.89","IPPrefixLen": 16,"IPv6Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"MacAddress": "00:15:5d:7e:60:60"}}}}] - The exact IP address of the container can be found using the command:
123docker inspect --format '{{ NetworkSettings.Networks.nat.IPAddress }}' cocky_mahavira
IIS main page is accessible at http://<container-ip>, as shown below:
The next part will show how to create your own Docker image on Windows Server 2016.
Source: blog.couchbase.com/2016/october/docker-on-windows-2016-server
Thank you for bringing more information to this topic for me. I’m truly grateful and really impressed. Really appreciate for your amazing article. Thank you for this valuable information.
Great to come to your site as the information shared is good and is explained in simple words. Good stuff you are created, thank you for sharing a nice article.
Why are there differences here as compared to your other blog post here: https://blog.couchbase.com/setup-docker-windows-server-2016/
Do everyone a favor and remove your outdated information, or at least put a note somewhere. Some of these commands don’t work, or have alternate ways to get them done, it would be nice AND informative if those alternates were mentioned so someone new to this doesn’t spend hours chasing their tail on the internet for the RIGHT way to install this. Thanks but I’ll avoid your tutorials from now on.
Great post. I found your website perfect for my needs. Very useful info specifically the last part. Thank you for sharing
If you are here to know about how you can get help with file explorer in windows 10 so have visit to windows file explorer can have useful information to you by which your can easily have fully access on it. Try out for once.
Very detailed guide, thank you very much. It remained relevant even at the time of 2018. As a pity that so little in the Internet such detailed information.