TABLE OF CONTENTS

Introduction

What is a Container?

Containers are a technology for packaging and running Windows and Linux applications across diverse environments on-premises and in the cloud. Containers provide a lightweight, isolated environment that makes apps easier to develop, deploy, and manage. Containers start and stop quickly, making them ideal for apps that need to rapidly adapt to changing demand. The lightweight nature of containers also makes them a useful tool for increasing the density and utilization of your infrastructure.

 

What are the tools and platform to run windows container?

  • Run Windows-based or Linux-based containers on Windows 10
  • Develop, test, publish, and deploy Windows-based containers
  • Publish your apps as container images
  • Deploy containers at scale on Azure or other clouds
  • Deploy containers on-premises

 

Run Windows-based or Linux-based containers on Windows 10

Run Windows-based or Linux-based containers on Windows 10 for development and testing using Docker Desktop, which makes use of containers functionality built-in to Windows.

 

Docker Desktop

Docker Desktop for Windows is Docker designed to run on Windows 10. It is a native Windows application that provides an easy-to-use development environment for building, shipping, and running dockerized apps. Docker Desktop for Windows uses Windows-native Hyper-V virtualization and networking and is the fastest and most reliable way to develop Docker apps on Windows. Docker Desktop for Windows supports running both Linux and Windows Docker containers.

 

Pre-requisites

To run containers on Windows 10, you need the following:

  • One physical computer system running Windows 10 Professional or Enterprise with Anniversary Update (version 1607) or later.
  • Hyper-V should be enabled.

 

Getting Started

This document describes how to:

  • Set up Windows 10 or Windows Server for containers using Docker and Docker Desktop
  • Run your first container image
  • Containerize NetSim and run parallel on multiple containers

 

Set up Windows 10 or Windows Server for containers using Docker and Docker Desktop


Step 1: Installing docker via command-line

 

To install Docker on Windows Server, you can use an OneGet provider PowerShell module published by Microsoft called the DockerMicrosoftProvider. This provider enables the containers to feature in Windows and installs the Docker engine and client. Here's how:

 

  1. Open an elevated PowerShell session and install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery.
    1. PowerShell Command: Install-Module -Name DockerMsftProvider -Repository PSGallery -Force.
    2. If you're prompted to install the NuGet provider, type Y to install it as well.
  2. Use the PackageManagement PowerShell module to install the latest version of Docker.
    1. PowerShell Command: Install-Package -Name docker -ProviderName DockerMsftProvider
    2. When PowerShell asks you whether to trust the package source 'DockerDefault', type A to continue the installation.
  3. After the installation completes, restart the computer.
    1. PowerShell Command: Restart-Computer -Force
    2. If you want to update Docker later, check the installed version with:
    3. PowerShell Command: Get-Package -Name Docker -ProviderName DockerMsftProvider
    4. Find the current version with:
    5. PowerShell Command: Find-Package -Name Docker -ProviderName DockerMsftProvider
    6. When you're ready, upgrade with:
    7. PowerShel Command: Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force
    8. PowerShell Command: Start-Service Docker

 

Step 2: Installing Docker Desktop:

You can install Docker on Windows 10 Professional and Enterprise editions by using the following steps.

 

  1. Download and install Docker Desktop, creating a free Docker account if you don't have one already. For more details, see the Docker documentation(View reference section).
    1. Docker Download Link: https://hub.docker.com/editions/community/docker-ce-desktop-windows
  2. Install Docker Desktop on Windows
    1. Double-click Docker Desktop Installer.exe to run the installer.
    2. If you haven’t already downloaded the installer (Docker Desktop Installer.exe), you can get it from Docker Hub. It typically downloads to your Downloads folder, or you can run it from the recent downloads bar at the bottom of your web browser.
    3. When prompted, ensure the Enable Hyper-V Windows Features option is selected on the Configuration page.
    4. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.
    5. When the installation is successful, click Close to complete the installation process.
    6. If your admin account is different to your user account, you must add the user to the docker-users group. Run Computer Management as an administrator and navigate to  Local Users and Groups > Groups > docker-users. Right-click to add the user to the group. Log out and log back in for the changes to take effect.
  3. Start Docker Desktop
    1. Docker Desktop does not start automatically after installation. To start Docker Desktop, search for Docker, and select Docker Desktop in the search results.
    2. Search for Docker app

 

search for Docker app

  1. When the whale icon in the status bar stays steady, Docker Desktop is up-and-running and is accessible from any terminal window.
  2. whale on taskbar

whale on taskbar

  1. If the whale icon is hidden in the Notifications area, click the up arrow on the taskbar to show it. To learn more, see Docker Settings.
  2. When the initialization is complete, Docker Desktop launches the onboarding tutorial. The tutorial includes a simple exercise to build an example Docker image, run it as a container, push and save the image to Docker Hub.

Docker Quick Start tutorial

  1. Congratulations! You are now successfully running Docker Desktop on Windows.
  2. During installation, set the default container type to Windows containers. To switch after installation completes, you can use either the Docker item in the Windows system tray (as shown below), or the following command in a PowerShell prompt:
    1. Powershell command:& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon

 

Run your first container image

This topic describes how to run your first Windows container, after setting up your environment as described in installing Docker for Windows for containers. To run a container, you first install a base image, which provides a foundational layer of operating system services to your container. Then you create and run a container image, which is based upon the base image.

 

Step 1: Install a container base image

All containers are created from container images. Microsoft offers several starter images, called base images, to choose from (see reference links for Container base images). This procedure pulls (downloads and installs) the lightweight Nano Server base image.

 

  1. Open a command prompt window (such as the built-in command prompt, PowerShell, or Windows Terminal), and then run the following command to download and install the base image:
    1. Command: docker pull mcr.microsoft.com/windows/servercore
  2. After the image is finished downloading—read the EULA while you wait—verify its existence on your system by querying your local docker image repository. Running the command: docker images returns a list of installed images.

 

Containerize NetSim and run parallel on multiple containers

Step 1: Run Docker-Desktop

Step 2: Click on Run

Step 3: Give Container Name, NetSim Path and Shared location in the container (make sure that the NetSim software must be installed on the container and your system)


Step 4: Click on Container/Apps > <Container Name> > CLI


Step 5: The following commands can be used here to Run NetSim via CLI

  1. Dir > To know the current directory
  2. Cd <foldername> >Go to foldername

 

References 

  1. Installation of Windows Container:
    1. https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/#:~:text=Containers%20are%20a%20technology%20for,develop%2C%20deploy%2C%20and%20manage.
  2. Docker Documentation
    1. https://docs.docker.com/docker-for-windows/install/
  3. Running Container 
    1. https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/run-your-first-container
  4. Container Base-images
    1. https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-base-images
    2. https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/run-your-first-container#install-a-container-base-image