0
votes

I am trying to complete an architectural research on how to properly work with Windows Containers within the Azure domain/environment where I have to containerize the Dot Net Core Web API application and deploy that container into an Azure Container Service

Here are the things that I did

  1. I did create an Azure Container Service account/domain/virtual machine within the Azure portal

  2. Also, I did create another virtual machine for the Windows Server 2016 with Containers that already had the Docker installed

  3. On the Windows server 2016 I did create a simple .NET Core Web API application and created an image for that application using Docker

  4. I did push the image of the Web API application into a Docker hub and using the SSH tunnel interface tried to download the image into an Azure Container Service, so it can be run from that service

However, I would get a message that the Windows Containers cannot run on Linux as the Azure Container Service by default is a Linux system

Is there a way to deploy a Windows Docker Container into an Azure Container Service a. Should I create Azure Container Service in Windows? b. Should I use another orchestrator (NOT Docker) to deploy a Windows Container into an Azure Container Service? c. Should I go down a different path?

Thank you very much in advance for your kind support!

1
Azure container service? which orchestrator are you choose? Kubernetes?Jason Ye
We are choosing docker swarm, thank you for your help!Mikhail

1 Answers

1
votes

the Windows Containers cannot run on Linux as the Azure Container Service by default is a Linux system.

As we know, container about Linux and windows are different, so we can't run windows container on Linux system.

As a workaround, we can create Azure container service(choose kubernetes) with windows agent, so we can deploy windows container to kubernetes windows agent.

We can via Azure portal to deploy Azure container service, select orchestrator to kubernetes, at agent configuration, we should select operating system to windows. In this way, the master of kubernetes is Linux, and the agent is windows.

We can use kubectl and docker file to create windows container. For example, we can deploy IIS container on windows agent. Kubernetes is a tool which use to manage containers, so we can use k8s to deploy IIS to windows nodes.

1.create iis.json file, like this:

{
 "apiVersion": "v1",
 "kind": "Pod",
 "metadata": {
   "name": "iis",
   "labels": {
     "name": "iis"
   }
 },
 "spec": {
   "containers": [
     {
       "name": "iis",
       "image": "nanoserver/iis",
       "ports": [
         {
         "containerPort": 80
         }
       ]
     }
   ],
   "nodeSelector": {
    "beta.kubernetes.io/os": "windows"
    }
  }
}

2.use kubctl apply command to create pods, like this:

kubectl apply -f iis.json

More information about how to use k8s to deploy a windows IIS container, please refer to this link.

If you want to use your container image, you can upload your image to Azure container registry, then pull the image from your registry.

How to set secret for Azure container registry and pull image, please refer to this answer.