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.
Contents
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)
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 is an international AWS cloud consulting, systems integration, and software development firm headquartered in Marina del Rey, CA.
We have built our reputation on helping media companies architect and implement cost-effective, reliable, and scalable Media & Entertainment workflows in the cloud. These include streaming and on-demand video solutions, media asset management, and archiving, incorporating the latest AI technology to build bespoke media solutions tailored to customer requirements.
Cloud-native software development is at the foundation of what we do. We specialize in Application Modernization, Containerization, Infrastructure as Code and event-driven serverless architectures by leveraging the latest AWS services. Along with our Managed Services offerings which provide 24/7 cloud infrastructure maintenance and support, we are able to provide complete solutions for the media industry.