Serverless Applications and Docker

How to Scale the Latest Trend in Infrastructure
Pieter van Noordennen
May 21, 2021

Christina @ wocintechchat.com / Unsplash

Serverless applications are all the rage in cloud architecture circles at the moment. It's easy to see why: This method of cloud computing provides both DevOps teams and application developers with loads of flexibility, on-demand scaling, and quick time-to-market.

But what are serverless applications, and how to they integrate with containers? Here's what you need to know.

What are Serverless Applications?

Serverless applications, or Function as a Service applications, provide backend services on an as-used basis, usually for a single operation or job. So while, of course, serverless applications still use servers, the rates for usage are set by the amount of use, rather than a fixed amount of bandwidth or a number of servers.

Serverless applications run at a lower cost because they do not charge for unused space or idle time. They offer simplified scalability, because their vendor will handle all scaling requests on demand, spinning up new services as requests from end users increase.

Most serverless providers — AWS, Google Cloud, and Microsoft Azure being among the more popular — also provide a variety of services such as databases and storage that integrate seamlessly with their servlerless products.

Similarly, serverless applications often have simpler backend code and quicker turnarounds for changes, which in many cases, can contribute to a faster time to market.

How Do I Implement Containers in a Serverless Environment?

Although originally Docker did not have a serverless integration, things changed in 2017 when Azure Container Instances and AWS Fargate came to market.

Because Docker containers often manage services that are meant to run in the background, serverless applications are an excellent fit for containerized apps. Dockerized systems can be sent to serverless applications, creating a clean and predictable 1:1 relationship between application and infrastructure. The containerization of functions allows services to perfectly match demand and thus run at a lower cost.

Ideally, containers would be best deployed in certain key instances where you want them to run as ephemeral jobs that start, do something, then stop. When you need long-lived computations or constant availability, spinning up Docker containers in a serverless app may not be performant or cost effective.

Most critically for your cloud bill, optimizing your container is key because billing starts as soon as you spin up your Docker container.

Many users of serverless applications actually consider the challenge of creating a framework for all of their functions to be the main pain point.

However, with Docker, developers have the ability to store all of their scripts into a bundle and then devote their energies to engineering an architectural framework in which they can all run together. Services like AWS Fargate can be intimidating to tackle, but once set up, offer a streamlined infrastructure that many developers find efficient and enjoyable.

What's the Best Cloud Platform for Serverless Applications?

There are a variety of instances in which Docker and serverless applications overlap to create a high-powered software deployment.

Amazon Web Services Fargate

The Amazon website describes AWS Fargate as “a serverless compute engine for containers that works both with Amazon Elastic Container Service and Amazon Elastic Kubernetes Service.” As per the benefits discussed above, this marriage of Amazon computing services and Docker allows you to place your focus on building your applications by removing the need to manage servers. Fargate is the most popular serverless application service at the moment. The recent release of their App Runner product helps coordinate build and deploy cycles.

Google Cloud Serverless

Google's Serverless Computing Department advertises the following benefits: speed to market, simple developer experience, and automatic scaling. Although we have previously discussed some of these benefits, you may be noticing one emerging as a trend: simple developer experience. You want your developers to be expanding on your company’s work, not spending all of their time and talents managing your servers.

Microsoft Azure Serverless

With the largest portfolio in the industry, Microsoft Azure prides itself on offering easy to run serverless applications that can be paired with Docker, just like their competition. While they maintain the same benefits as the services we’ve listed above, Azure has a reputation for offering the latest and greatest in cybersecurity, as well, which is comforting for DevSecOps teams given the often frenetic pace of shipping that comes with serverless approaches.

Other Serverless Computing Platforms

There are a variety of other serverless computing platforms that can be paired with Docker for incredible results and don't come from "the Big Three." If you want something more boutique for your stack, consider the following options:

  • Cloudflare Workers - Not only a security company! Run JavaScript worldwide.
  • Now by Zeit - Push the code, and let the software behind Now handle the rest.
  • IBM Cloud Functions - Based on Apache OpenWhisk, IBM prides itself on quick application actions.
  • Alibaba Function Compute - With deep roots in the APAC market, Alibaba's cloud services are emerging as an international contender
  • Edge Engine - One of the lowest latency offerings with an incredible affordable starting price.

What Are the Challenges in Deploying a Containerized Serverless Environment?

Like any new way of functioning, there can be pain points that users should be aware of when creating a container-based serverless environment.

First, Docker or not, you should expect that engineers working with serverless might need additional time to be productive. Because this technology is still relatively new, it is important to budget research and testing time for your developers to do their best work in serverless projects. Training and onboarding time is important for developers switching to this approach.

Additionally, where Docker users could previously get by without having any cloud knowledge, users looking to combine their powers with serverless applications will likely need to build their understanding of the cloud in order to do their best work. Basic understandings of cloud infrastructure, user permissions, and networking will best set up developers for success when leveraging serverless approaches.

Finally, and perhaps most critically, optimizing because billing starts as soon as you spin up your Docker container, image size is critical. If you have not optimized your image size by using container best practices, then you will be getting charged for additional space that you are not using, and possibly opening yourself up to security risks.

Stay on the Cutting Edge of Containers with Slim.AI

We know it and you know it: Serverless applications are trendy right now, and containers will need to work hard to ensure that they remain collaborative with these emerging services. Whether you’ve found a new way to **reduce your Docker image sizes **to keep your costs down, or have tried out a new serverless application with your containers, we’d love to hear how things are going! Request access to our closed beta and build with us today.

Related Articles

5 Most Commonly Asked DockerSlim Questions

We enlisted DockerSlim expert and Slim.AI Developer Experience Engineer to dive into how container slimming works.

Primož Ajdišek

Technical Staff

5 Ways Slim Containers Save You Money

Do slim containers really save you money on your cloud bill? Are there cost advantages to smaller containers? Find out here.

Chris Tozzi

Automating DockerSlim in Your CICD Pipeline

Using GitHub Actions, you can refine container images automatically making them smaller, faster to load, and more secure by default – all without sacrificing any capabilities.

Nicolas Bohorquez

Contributor

Building Apps Using Cloud Native Buildpacks

Getting started with this innovative technique

Vince Power

Contributor

Building DockerSlim into a Jenkins Pipeline

A step by step tutorial on building DockerSlim into your CI/CD pipeline.

Clarifying the Complex: Meet Ivan Velichko, Container Dude at Slim.AI

Ivan recently joined the team at Slim.AI, and we sat down with him to learn more about the path that led him here.

Ivan Velichko

Container Dude

Container Insights: Dissecting the World's Most Popular Containers

Join Ayse Kaya in this series, as she creates her 2022 Container Report Chalk Full of Important Security Findings for Developers.

Ayse Kaya

Analytics & Strategy

Container of the Week: Python & Flask

Our weekly breakdown of a popular container

What We Discovered Analyzing the Top 100 Public Container Images

Complexity abounds in modern development

Ayse Kaya

Analytics & Strategy

2022 Public Container Report

Vulnerabilities continue to increase and developers are struggling to keep up.

Ayse Kaya

Analytics & Strategy

Containerizing Python Apps for Lambda

A tutorial on deploying AWS Lambda using containers, Python edition.

Docker Containers for Your Raspberry Pi

Compact PCs need compact apps

Martin Wimpress

Community

Explore and analyze a Docker container with DockerSlim X-Ray

Understanding container composition

Martin Wimpress

Community

Five Proven Ways to Debug a Container

When Things Just Are Not Working

Theofanis Despoudis

Contributor

Five Things You Should Never Ship to Production in a Container

Here is our take on five things to avoid when creating a container or shipping it to production.

Chris Tozzi

Increasing Your CI/CD Velocity with Slim Containers

We’ll explain what Slim Containers are, how they speed up the build process, and how they can improve the efficiency of your testing.

Mike Mackrory

Contributor

Integrate Testing into Your Container Pipeline

A closer look at testing within container pipelines, CI/CD, software delivery, and containerization.

Faith Kilonzi

Software Engineer

Reducing Docker Image Size - Slimming vs Compressing

Know the difference

Pieter van Noordennen

Growth

Slim.AI Docker Extension for Docker Desktop

How to access our Docker Extension and try it for yourself.

Josh Viney

Product

Slimming a Rails Application with DockerSlim

Dissect a simple Rails application container using DockerSlim to analyze, optimize, and deploy your product more quickly.

Theofanis Despoudis

Contributor

Where Do You Store Your Container Images?

Container Registry Options are Growing in Number and Complexity

Pieter van Noordennen

Growth

Using AppArmor and SecComp Profiles for Security Audits

Conduct better container security audits using tools like SecComp, NGINX, and Docker.

What’s in your container?

Why Docker Layers matter for container optimization

Pieter van Noordennen

Growth

Why Developers Shouldn't Have to Be Infrastructure Experts, Too

Simplifying processes required to containerize and deploy cloud-native apps.

Chris Tozzi

A New Workflow for Cloud Development

Leverage the benefits of containerization without the headaches & hassle

John Amaral

CEO

Why Don’t We Practice Container Best Practices?

Container best practices are easy to understand, hard to do

John Amaral

CEO

Better Security Audits with AppArmor and SecComp via DockerSlim

Combine the power of tools like SecComp, NGINX, and Docker.

Cloud Development Is Still Too Manual & Complex

Lessons we learned from interviewing more than 30 developers

John Amaral

CEO

Getting Started with Multi-Container Apps

Up your container game with Docker Compose

Nicholas Bohorquez

Contributor

The Squeak Interview

CEO John Amaral joins Chris on his livestream

Meet DockerSlim's Compose Mode

Optimize a multi-tier app with a single command

Ian Juma

Technical Staff