<p>More of a general question -
Assume all my tech stack has to be on K8S (for example cloud vendor agnostic):
When should I use serverless on top of K8S (e.g nuclio, kubeless) - and when to keep service as docker?
I ask this because the "auto-scaling" I get for free for both of them - so I wonder when I should use another framework...</p>

<p>To simplify - assume everything is stateless...no sessions </p>

user1025852
<p>I will start by saying that Serverless is more innovative technology than Docker Containers. However, they both have their advantages and disadvantages.</p>

<h1>Serverless</h1>

<p>Starting from Serverless, it is possible to build them for virtually any type of application or backend service, and everything required to run and scale your application with high availability is handled for you.</p>

<h2>Pros:</h2>

<ul>
<li><p>Deployment simplicity. There’s no need to administrate infrastructure — just upload your functions, and that’s all. No Dockerfiles or Kubernetes configurations.</p></li>
<li><p>Almost all Serverless solutions support event triggers, which means they are great for pipelines and sequenced workflows.</p></li>
<li><p>As you pay per function execution, Serverless is cheaper than containers. When an application is not being used, it shuts down, and you don’t pay for the idle time (you have mentioned that you don't have to pay for auto-scaling). </p></li>
</ul>

<h2>Cons:</h2>

<ul>
<li><p>When the Serverless app grows, it is hard to troubleshoot because of the way the FaaS applications are designed to work.</p></li>
<li><p>Serverless always depends on a third party vendor, so that changing the cloud provider can be a headache.</p></li>
</ul>

<h1>Docker Containers</h1>

<p>Docker is a containerization platform that packages your application and all its dependencies together in the docker container.</p>

<h2>Pros:</h2>

<ul>
<li>Container technology enables you to scale your applications as much as you want. </li>
<li>Docker containers are vendor-agnostic, whereas going Serverless always depends on a third party.</li>
<li>You have full flexibility and control with Docker containers in terms of setting policies, managing resources, and security.</li>
</ul>

<h2>Cons:</h2>

<ul>
<li>Containers utilize resources more efficiently than virtual machines, but they are still subject to performance overhead due to overlay networking, interfacing between the container and the host system.</li>
<li>By default, all of the data inside a container disappears forever when the container shuts down unless you save it somewhere else first.</li>
</ul>

<h1>Conclusion</h1>

<p>If you want to reduce application management and don’t care about the architecture - Serverless is the best option. If you want to deploy an application on specified system architecture with having control over it, then Docker containers are the best option. So when comparing Serverless vs Docker, it comes down to choosing what is better for your particular needs.</p>

<p>I encourage to read <a href="https://thenewstack.io/why-serverless-vs-kubernetes-isnt-a-real-debate/" rel="nofollow noreferrer">interesting article</a> about it.</p>
