We recently had to migrate an ASP web application to Docker. ECS fully supports Windows containers, if you are aware of some limitations and workaround compared to Linux.

Introduction

Migrating a web application to Docker can provide many benefits, such as increased portability, scalability, and easier management. However, when dealing with Windows-based applications, there are some unique challenges and limitations to be aware of. In this article, we will discuss our experience migrating an ASP web application to Docker on Windows, including the process of building and deploying Docker images, as well as some unexpected issues we encountered along the way. We’ll also provide some helpful workarounds and strategies to overcome these challenges and ensure that your containers are running smoothly on ECS.

Using Docker on Windows

When using Docker on your own machine, it only supports Linux images. To build and use Windows images, you will need to enable the experimental and Windows support mode.

Building the containers

Before deploying our containers on ECS, we had to build the Docker image of our application. So naturally, we build it on our own Windows 10 desktop. We tested it, it was working fine so we pushed it to ECR.
Once deployed on ECS, the container was unable to launch :
image operating system “windows” cannot be used on this platform

To our surprise, a windows built on Windows 10 couldn’t be running on Windows server 2016. You have to build on the same system than your target. My advice would be to build your container on the same ami than your ECS instances.

Fix unexpected exits on Windows IIS

In our case, the application was running on IIS, the Microsoft webserver. In theory everything should have been working. But the container was exiting unexpectedly with no logs or specific error more than “Service ‘w3svc’ has been stopped”.

It’s due to a bug in ECS, where if you leave the CPUcredits for the containers at 0, it will not give all ressources to the container, and will instead set CPUPercent to 1

To fix this you need to do the following inside your task definition:

  • Set the network mode to default
  • Set the task memory to 1024mb
  • Set CPU units of your container definition to 1024 (corresponds to CPUPercent at 25)
Migrating Windows Application to Containers on ECS : Our Experience 2019 - image 1

Conclusion – Migrating from Windows to ECS

In conclusion, migrating an ASP web application to Docker on Windows may present some challenges and limitations, but these can be overcome with the right strategies and workarounds. It’s important to build your Docker image on the same system as your target and to be aware of bugs and issues that may arise, such as unexpected exits on Windows IIS. By setting the network mode to default, task memory to 1024mb, and CPU units to 1024, you can fix this issue and ensure that your containers are running smoothly on ECS. With the right approach, Docker can be an effective tool for deploying and managing web applications on Windows.

About TrackIt

TrackIt, an Amazon Web Services Advanced Consulting Partner based in Marina del Rey, CA, offers a range of cloud management, consulting, and software development solutions. Their expertise includes Modern Software Development, DevOps, Infrastructure-As-Code, Serverless, CI/CD, and Containerization, with a focus on Media & Entertainment workflows, High-Performance Computing environments, and data storage.

TrackIt excels in cutting-edge software design, particularly in the areas of containerization, serverless architectures, and pipeline development. The company’s team of experts can help you design and deploy a custom solution tailored to your specific needs.

In addition to cloud management and modern software development services, TrackIt also provides an open-source AWS cost management tool to help users optimize their costs and resources on the platform. With its innovative approach and expertise, TrackIt is the ideal partner for organizations seeking to maximize the potential of their cloud infrastructure.

Logo1 colour RGB 8