DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Apache Kafka vs. Message Queue: Trade-Offs, Integration, Migration
  • File Upload Security and Malware Protection
  • Logging Best Practices Revisited [Video]
  • Redefining DevOps: The Transformative Power of Containerization
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Docker on Windows Server 2016 (Part 2)

Docker on Windows Server 2016 (Part 2)

Follow along to learn how how to configure Docker on a Windows 2016 virtual machine.

Arun Gupta user avatar by
Arun Gupta
·
Nov. 03, 16 · Tutorial
Like (1)
Save
Tweet
Share
3.04K Views

Join the DZone community and get the full member experience.

Join For Free

This blog is 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:docker-windows-2016-22 Run the script to install Docker:

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Restart-Computer -Force


This will install the PowerShell module, enable containers feature and install Docker.

docker-windows-2016-23The 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 the Docker version using docker version:

docker-windows-2016-24More details about Docker can be found using the docker info command:

docker-windows-2016-25

Run your first Docker container using the docker run -it -p 80:80 microsoft/iis  command:

docker-windows-2016-26This 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 the docker ps command:

docker-windows-2016-27More details about the container can be found using the docker inspect command:

[
  {
    "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:

docker inspect --format '{{ NetworkSettings.Networks.nat.IPAddress }}' cocky_mahavira


The IIS main page is accessible at http://<container-ip>, as shown below:docker-windows-2016-28

The next part will show how to create your own Docker image on Windows Server 2016.

Docker (software)

Published at DZone with permission of Arun Gupta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Apache Kafka vs. Message Queue: Trade-Offs, Integration, Migration
  • File Upload Security and Malware Protection
  • Logging Best Practices Revisited [Video]
  • Redefining DevOps: The Transformative Power of Containerization

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: