ELI5: What are Serverless and Containers?

Think of containers like lunchboxes — each one has everything a meal needs, packed neatly so it does not mix with anyone else’s food. You can stack many lunchboxes on one table. Serverless is even simpler: instead of packing your own lunch, you just tell the cafeteria what you want, and they make it for you on the spot. Both are ways to run programs on computers more efficiently, but each comes with its own safety rules to follow.

Overview

Containers package applications with their dependencies into isolated units that share the host OS kernel, providing lightweight and consistent deployment. Serverless computing abstracts the infrastructure entirely, allowing developers to deploy functions that execute on demand without managing servers. Both models accelerate development but introduce security challenges around image integrity, runtime isolation, and supply chain risks.

Key Concepts

  • Containers:
    • Share the host OS kernel; lighter than VMs but weaker isolation
    • Container images — immutable templates; must be scanned for vulnerabilities before deployment
    • Container registry — repository for storing and distributing images; secure with access controls and signing
    • Container orchestration (Kubernetes) — manages deployment, scaling, and networking of containers
    • Container escape — breaking out of a container to access the host; similar to VM escape but more likely due to shared kernel
    • Ephemeral nature — containers are short-lived; logging and monitoring must capture data before termination
  • Serverless (Function as a Service / FaaS):
    • Provider manages all infrastructure; customer only writes and deploys code
    • Event-driven — functions execute in response to triggers (API calls, messages, schedules)
    • Cold starts — latency when a function is invoked after being idle
    • Execution time limits — functions have maximum execution durations
    • Security risks — insecure function code, excessive permissions, dependency vulnerabilities, injection attacks
  • Shared security concerns:
    • Supply chain attacks through compromised base images or dependencies
    • Secrets management for credentials and API keys
    • Least privilege for function/container permissions

Exam Tips

Remember

Containers share the host kernel = weaker isolation than VMs. Always scan container images for vulnerabilities. Serverless = provider manages infrastructure, customer manages code and permissions. Both are ephemeral, making logging challenging.

Connections

Practice Questions

Scenario

See case-serverless-and-containers for a practical DevOps scenario applying these concepts.