Will serverless computing eventually replace Docker? That’s the conclusion the internet seems to be drawing. But it’s the wrong way to think about the relationship between Docker containers and serverless computing.
Serverless computing refers to platforms that allow an organization to run a specific piece of code on-demand. It’s called serverless because the organization does not have to maintain a physical or virtual server to execute the code.
Platforms including AWS Lambda, Azure Functions and (for an on-premises version) Fission.io make it readily available to organizations today.
Predicting the Doom of Docker
Some folks see serverless computing as a technology that will kill Docker—or at least sharply reduce the use cases for Docker containers.
Because of serverless computing, “container will see workloads shrink,” one observer writes. Another predicts that it will usher in “a post-virtual machine, post-container world.”
Why do some people see the serverless computing revolution as a threat to Docker? Mostly because they perceive serverless functions as an even more efficient way to deploy application code than Docker containers.
In one sense, it doubles down on the efficiencies that Docker containers offer. Docker containers reduce the management burden associated with virtual machines. They also provide more scalability.
Serverless functions take things a step further. They eliminate the need to set up and manage any type of infrastructure, beyond the very basic task of loading the code for serverless functions into the serverless platform.
Why Serverless Computing Won’t Kill Docker
Still, I don’t see serverless computing as a big threat to Docker containers. Although it offers important advantages Docker lacks in certain situations, for the most part serverless computing and Docker containers are different sorts of technologies.
In other words, their functionality overlaps to only a limited extent. You can’t use serverless functions to run an SSH server, for example.
Nor can serverless computing, on its own, be used to construct all of the infrastructure you need to deploy a web application. It might come in handy for executing parts of your code within the web application, but serverless functions won’t work well for hosting services that need to be constantly turned on and listening for connections.
After all, the essence of serverless functions is that they run only when they need to. That’s how they add efficiency to your workloads: They obviate the need to maintain a server permanently while only using it occasionally. If your serverless functions are running non-stop, then they’re defeating their own purpose.
Conclusion
Simply put, it’s wrong to think of serverless computing and Docker as competing technologies.
Yes, serverless computing is poised to be a key innovation that will help usher in the next generation of infrastructure technology. Serverless functions will be the shiny, new thing in your stack after Docker containers have gone mainstream and lost their luster.
But you simply can’t use serverless functions to accomplish most of the tasks you do with Docker containers, and vice versa. You’ll need both.