Containers are portable, self-contained packages of software that contain everything that's needed to run an application, like the application code, runtimes, libraries, and other dependencies. You can run the same containerized application across various environments and infrastructure, because the essential dependencies of the application are already in the container. This document helps developers and cloud architects to understand containerized applications, compare the Google Cloud container platforms, and learn about the use cases and considerations that are associated with containers.
Overview of containers
Containers package application code and dependencies into portable, isolated units of software that can run in different environments. You package your code into container images that you store in a container registry. Google Cloud provides the infrastructure, orchestration software, and runtimes to deploy these containers.
Containers are designed to be portable, lightweight, and scalable. These properties are ideal for microservice architecture, in which you split a large application into multiple services that each handle a discrete task.
Differences between containers and VMs
Similarly to containers, virtual machines (VMs) are another form of virtualization that you can use to create isolated environments for applications. Unlike containers, VMs are full instances of an operating system that run on a physical host machine and use a hypervisor to virtualize the hardware on the physical host. Each VM has its own CPU, network interfaces, storage devices, and memory devices.
The hardware virtualization and the presence of a full OS on each VM mean that VMs are much larger in size, less portable, and slower to scale than containers. You can run containers on VMs in the same way that you'd run containers on physical machines. For more information about the differences between containers and VMs and when to use each, see Containers versus VMs.
Container orchestration
If you're deploying small numbers of containers that aren't related to each other, you can manually manage the containers. However, automation becomes necessary when you scale to hundreds or thousands of containers. Container orchestration is the automated management of containers and infrastructure across an environment.
A container orchestration platform handles infrastructure autoscaling, networking, storage, availability, security, and various other factors for containers at scale. The open source Kubernetes software is a container orchestration platform that's available as a managed service on Google Cloud. You can declaratively tell Kubernetes where you want your containerized applications to run, and the system manages the infrastructure and application lifecycle.
Container deployment options in Google Cloud
You can deploy containerized applications on various Google Cloud products.
Choose a container platform
The Google Cloud service that you choose for your containerized applications depends on your specific workload needs and how much control you want over the infrastructure:
Batch: you want to run asynchronous, run-to-completion processing jobs (such as data pipelines or rendering) that pull tasks from a queue and terminate when complete, on infrastructure that's fully managed for you.
Cloud Run: you want to deploy stateless apps like inference workloads, web services, APIs, or event-driven microservices on infrastructure that's fully managed for you. Cloud Run automatically scales to zero when idle.
Google Kubernetes Engine (GKE): you want to run stateless or stateful applications at scale with Kubernetes orchestration, flexible control over infrastructure, and multi-cluster deployments.
Compute Engine: you want your containers to have control of the host operating system, make custom kernel modifications, run specialized system daemons, or use unmanaged accelerator configurations.
For more information about when to use each of these platforms, including a full decision flowchart and a detailed comparison of features, see Choose compute options.
Infrastructure lifecycle management
If your containerized applications run as part of tightly coupled high performance computing (HPC) simulations or distributed AI training architectures scheduled by workload managers like Slurm or Kubernetes, then you can use infrastructure automation tools to deploy and manage the underlying clusters:
Cluster Director: automates the deployment and scaling of clusters that are optimized for AI, ML, and HPC workloads without requiring manual network and OS configuration. Cluster Director supports both a managed Slurm environment and managed compute clusters for custom orchestrators. For more information, see Cluster Director overview.
Cluster Toolkit: provisions HPC and AI clusters based on customizable blueprints and deployment templates. For more information, see Cluster Toolkit overview.
Related services for containers
Deploying containerized applications at scale involves supporting services that manage the container lifecycle from source code to production:
Build: Cloud Build imports application code, installs dependencies, and compiles code into OCI-compliant container images on Google Cloud infrastructure.
Store and manage: Artifact Registry stores, versions, and manages your container images, providing automated vulnerability scanning and access controls.
Deploy: Cloud Deploy automates the delivery of containerized applications through continuous delivery pipelines to GKE, Cloud Run, and Compute Engine.
Secure: Binary Authorization enforces software supply chain security policies by verifying digital signatures before container images can deploy. Secret Manager stores and manages sensitive runtime data (such as API keys and database credentials) separately from container images and host infrastructure.
Pricing considerations
Each of the Google Cloud services that support containers has specific pricing considerations that might affect which platform you choose, as follows:
- Batch: you incur charges for any billable Google Cloud resources that jobs use. For more information, see Batch pricing.
- Cloud Run: you incur charges for the resources that your applications use, such as CPU, memory, and accelerator capacity. By default, Cloud Run bills you only when your application processes requests. You can optionally create long-running instances that incur charges even when there are no incoming requests. For more information, see Cloud Run pricing.
- GKE: in Autopilot mode, general-purpose workloads incur charges only for the resources that the workloads request. Workloads that request specific hardware and workloads in Standard mode incur charges for the underlying Compute Engine instances. GKE also charges a cluster management fee. For more information, see GKE pricing.
- Compute Engine: you incur charges for the Compute Engine instances, Cloud Storage disks, and other resources that you provision for your applications. For more information, see Compute Engine pricing.
What's next
- Get started with Batch
- Deploy a container to Cloud Run
- Deploy a containerized app to a GKE cluster
- Deploy containers on Compute Engine instances