Now that I finished the flow to push the code from my laptop up to the Cloud. I also started to play around with Docker; also a bit of ASP.NET Core. I have many dots. The next challenge, as always, is to connect them. Try to make sense from all pieces. Let’s focus a bit more on Docker; create a connection between Docker and ASP.NET Core.
There are many materials about Docker. It is easy to start playing around with Docker, as I wrote here. Pretty basic stuff. It is easy to find out how to run a command. The Docker website has an extensive documentation, which tells you everything you need to know about Docker.
But, to me, It is useless if I cannot make sense of “the why”. After playing around with commands, watching some courses (mostly from Pluralsight), I have to find the answer for questions
- Why do I need it?
- What problems does it solve?
I try to create an image of it in my mind. It is such an important step, that if I fail, I cannot continue. Just like, how can you run if you do not know why and where to run!
So let give it a try before moving deeper into the implementation detail.
Why Docker? Container Approach
I would like to call it “Container Approach“. Below are some benefits, in my opinion, that give me good reasons to invest in.
If we develop small systems which are easy to setup and deploy, the need of Container might not be obvious. Because, as a developer, we can check out the code, hit F5 and we are good to go. If we want to deploy those systems to QA’s machine or some sort of central servers, it is still a trivial task.
However, when systems are big where there are many services, require complex infrastructure, things get complicated quickly and cost lots of time. Take an example of a web application. I would assume the system consists of
- Front end application: Build on top of AngularJS. This application will connect to a backend service via WebAPI endpoints.
- Backend service: The backend service built with ASP.NET Core. It supplies endpoints that Front end application will consume.
- Database: SQL family server. Can be SQL Server, SQL Express, SQLight, or MySQL. Use EF as Data Access Layer (ORM).
The team consists of Frontend Developer, Backend Developer, and Tester. Each might have to install the same infrastructure to run the application. Given that we have not had a central deployment place yet. It means that
- Front end developer has to install all requirement software, infrastructure, that only Backend Developer required.
- Back end developer has to install the things that only Front end developer needs.
- Tester has to install development environment even they do not know about coding. They might have to setup local IIS.
When a new member joins the team, there are so many repetitive works.
- Front end developer will take the api component, and load it up on his machine without installing anything. He will focus on building the cool frontend, and connect to that API.
- A tester will take the application as a whole, and run it with a single click, without installing anything.
With a proper developed, Docker can help.
Develop Faster, Test Faster
Docker will give us the minimum-required infrastructure we need to build and test an application. For example, when I want to develop a system running with MongoDB. Instead of downloading and installing MondoDB locally, I can get a prebuilt docker image with MongoDB installed.
The ability to switch infrastructure gives developers a lot of flexibilities.
Develop Componentized Thinking
This might not be true for others. However, it works for me. I shape my thinking process. A system composes of many small components. Each component might run in a Container. This, in turn, will force me to think, what should I put in a single container.
I try to make sense of Docker, try to explain it to me. I do not make any suggestion or judgment regarding its benefits. But will all those in mind, I am ready to invest more in the journey.
- Improve cooperation
- Develop faster, test faster
- Develop componentized thinking
The next step is, as usual, to try things out. Connect the dots between Docker and ASP.NET Core. This post intended to write about it. However, I changed the intention as I wrote.