The cloud industry is evolving quickly right now, and when it comes to the big trends likes containers and serverless it can be hard to work out the difference.
Are Containers Serverless? No. Containers are a method of packaging up an application with its dependencies. Container technology does not mandate how the application is to be executed. However there are container platforms which allow you to execute containers in a way that is serverless.
That definition might seem like a bit of a tongue twister, but I’m precise for a good reason, as it is important to understand clearly the boundaries of the two technologies. There’s some nuance involved in answering todays question, so let’s break things down. Let’s start with containers and what they are.
What are Containers?
Containers are a way to package up an application and it’s dependencies into a unit of software. You can think of a container as a recipe, or a set of instructions used to create an application.
In reality a container is just a special type of protected process which runs on a machine or server in a specific way. The reason everyone is so fanatical about containers relates to their ability to be ported, their portability.
Containers by design are portable, are easy to move between servers, and can be multiplied (scaled) easily when architected correctly. This ability to scale containers makes them popular in use cases which involve heavy load.
When people talk about containers, Docker will quickly enter the conversation. Docker is currently the most popular container technology. But, containers are a generic concept—not unique to Docker—and there are other options such as rkt.
In summary: containers are a way to package an application.
Now that we understand a bit more about containers, let’s introduce serverless into our discussion. What is serverless?
What is Serverless?
Serverless is a cloud execution model. In serverless, the cloud provider takes responsibility for the servers (the underlying machines) leaving the customer solely responsible for what is running on the machines.
With serverless there is a server (somewhere), it’s just not your concern.
When people talk about Serverless they often mean functions as a service (also known as FaaS). Functions relates entirely to the compute side of serverless, so simply put: FaaS is the running of application code in a serveress way.
But, serverless can be applied to all parts of the technology stack, not just compute. Aspects like databases can also be ran in a serverless way, check out Aurora Serverless for an example of this.
Serverless doesn’t dictate how applications are packaged, but it does dictate how they run. For instance, AWS Lambda (which is the most widely used serverless service currently) uses zip files to bundle up applications for deployment.
In summary: serverless is a cloud execution model.
But that still might leave you wondering about your original question: “Are containers Serverless?”. And the answer is, it depends. Because it all depends on what cloud service the containers are running on. Let me explain.
So, Are Containers Serverless?
What dictates whether containers are serverless or not is the way they are executed. Since containers are just processes—not full machines—containers need to be executed as part of an execution environment (a server).
With containers, you are given the option to either setup and manage your own server to deploy your containers, or you can use an existing managed service which will manage the server for you: serverless.
Services, such as AWS Fargate allow containers to be ran in a serverless way, where AWS takes care of the infrastructure and platform, and you, the customer, simply provide the container (application) to be ran.
So, to go back to our original question: Are containers Serverless? The short answer is no. But the long answer is, that it depends on the way you choose to hose and execute them.
Containers Vs Serverless
Hopefully this article helped you out understanding a bit more about the differences between containers and serverless.
I hope you now see that’s it’s not so much an either/or type conversation when it comes to containers and serverless, as containers can be serverless, or not, it depends all on how they’re executed.
For more on Serverless development, be sure to check out: Serverless: An Ultimate Guide. And if you’re looking to get into cloud, it might be worth checking out my Recommended Books & Courses For Cloud Engineering.
- Open Up The Cloud Newsletter #26 (July Recap 2021) - August 19, 2021
- Open Up The Cloud Newsletter #25 (June Recap 2021) - July 12, 2021
- Which Is The Best AWS Region For Your Location? Based on Cost & Latency - July 7, 2021