Jan. 23, 2019
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.
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.
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.
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: