Why Docker Containers for .NET Are Great?
Why Docker Containers for .NET Are Great?
Why Docker Containers for .NET are great?
Docker container quickly conquered the Linux world but for Windows, they are just in the beginning. The question “is it worth to use Docker containers for Windows” is still actual due to Microsoft .NET had solved problems where containers rock in PHP and NodeJS worlds. One more article you should read if you're interested in this technology stack is dedicated to ASP.NET pros and cons.
So why should we use containers for .NET?
There are several reasons:
Scaling
It is easy to scale your application on load.
Many applications start from a low number of users but with a plan to increase the audience. Or it could happen that despite regular audience load of the web solution is low, from time to time the number of users could spike and be very high. In this situation, Docker container is great and allows scaling instances on demand and has good cost value balance.
Migration Instances
No dependency on a server and hosting provider. The application can be moved to a new instance with minimal effort.
Sometimes the application requires to be moved from one server to another. You could need more CPU power or memory, upgrade the operating system or fix some problems with hardware. All these reasons create risks which Docker solves perfectly.
Docker containers can be easily moved to another server while the current server is in maintenance mode or retire.
Testing and Delivery
An application can be tested locally on a development machine and then be delivered in production.
New code could require a server updating, is not a rare case. It could negatively affect maintenance, as other solutions hosted on the same server can stop while upgrading the framework or components. It happens because many upgrades run on a server level.
Last time when I was upgrading old Windows server, Docker was unable to use, and the latest version of ASP.NET Core installation shut down all websites in IIS. Finding out urgently how to fix it and to rollback, server changes was a real stress.
Delivering code with Docker containers guarantees isolations of all upgrade operations on Docker container level. Also, all preparations developer can make locally and ensure all functionality work and only than containers will be deployed on a server.
Monitor Resources
You can monitor how much CPU and memory Docker container consumes.
Tracking consumed resources when a server hosts many applications is a difficult task for system administration. Fortunately, with Docker containers, it is easy to identify which application takes processor time or consumes too much memory. Identifying such issues simplifies the work and give system administrators and developers chance to invest time adding improvements to increase the clients and end users satisfaction.
Shape Hardware Resources
Docker container resource consumption can be limited by CPU core and memory.
All parts of the system can be restricted by consumed resources whether it is memory or CPU. No any more situations when all resources are eaten by one job and the whole application performance dropped due to it.
Microservice Architecture Approach
It simplifies management infrastructure with many instances.
It is a trend to use microservices architecture for building complex applications. Instead of one big monolith, we can have many applications which collaborate with each other.
Old monolith applications break into several small ones that let a company scale development giving splitting responsibility among teams.
In both cases, Docker is part of the ecosystem that makes hosting simpler.
Delivery of new releases and rollback failed scenarios is managed with Docker tools.
Memory and CPU consumption is under control. With this, you can finally enjoy a feeling of confidence.
Code Isolation
Containers, where the code is running, are isolated from each other.
Code isolation provides one extra security level and allows better control of it. One development team can have access only to their part of the system and data.
Shutting Down, Up and Running
Containers can be easily up and running and shut down with the script.
When we set up the local environment or need a testing session from quality assurance department it is good to have an option to easily run and then shut down the application when it is not needed anymore in order to free up server resources.
Platform Independence
It is possible to run Windows containers on Linux and vice versa.
Nowadays when microservices are popular and we are not limited with a single language or framework we need a way to run them independently on the platform. With Docker it is possible and Ubuntu can be running on Windows machine together with containerized Windows Server.
Backup Plan Every time
Easy to revert previous code, if you put it into the container
A container preparation, and building and deploying it to production takes more time compared to direct deployments. It is a disadvantage when all passes good, but in case of emergency, Docker allows to rollback the application immediately. It can save money to your clients and reputation to you.
Summary
If you still wonder if to use Docker Containers for Windows, our answer is Yes. There are many benefits for .NET projects that could simplify the workflow and increase efficiency.
- Docker
- Windows
- .Net