Managed container hosting
Three layers of managed container hosting
A container image packages an application and its dependencies. A registry stores and distributes images; a runtime starts containers from those images; an orchestrator coordinates running workloads. Managed hosting delegates some infrastructure work to a provider, but you still own application behavior, configuration, access and data.
Imagine a bookstore API that returns a catalog. Its build produces an image, the private registry holds that artifact, and a managed service runs copies that answer requests. Uploading the image alone creates no running API.
build -> private registry -> managed execution -> running replica ^ authorized clientThe arrows show artifact flow and request flow, not actual network routes. Review Chapter 7 on containers and Chapter 22 on managed application hosting before deploying.
Compare the cloud service families
AWS: Amazon Elastic Container Registry (ECR) stores images. Amazon Elastic Container Service (ECS) defines tasks and manages services; Fargate supplies managed compute for supported ECS workloads. A task definition describes container image, resource requirements and runtime settings; a task is a running instantiation. An ECS service maintains a desired task count, while one-off tasks can run to completion. ECS can also use EC2 capacity.
Azure: Azure Container Registry (ACR) stores artifacts. Azure Container Apps provides managed application hosting with ingress, revisions and scaling. Azure Container Instances (ACI) runs container groups for simpler execution needs; check the current deployment and scaling options rather than assuming it implements the same app abstraction as Container Apps.
Google Cloud: Artifact Registry stores artifacts. Cloud Run services host request-driven containers, while Cloud Run jobs execute work to completion. A service revision is a versioned deployment configuration. These products are comparable by role, not identical in capabilities.
Choose a request-driven service for the bookstore API, a job or task for a nightly report, and a registry in either case. Compare supported protocols, CPU architecture, volume requirements, network access, execution duration, region and operational ownership. Managed Kubernetes is a different option when cluster-level APIs and controls are genuinely required.
Describe a deployment without deploying it
The following is an original planning record, not a provider API or deployable manifest. The registry name and image digest label are fictional; no image exists at this address.
{ "workload": "catalog-api", "image": "registry.example/catalog@sha256:<approved-digest>", "cpu": 1, "memoryMiB": 512, "containerPort": 8080, "ingress": "authenticated-private", "minimumReplicas": 1, "maximumReplicas": 4}Replace the digest placeholder only after building and approving an actual image. Map each field to the selected platform's API and verify supported CPU/memory combinations. In Cloud Run the ingress container must listen on the platform-provided port on all interfaces inside the container; this is not permission to expose the service publicly. Azure Container Apps has configurable ingress and target port. An ECS service can use an appropriate load balancer or private service connectivity. Network reachability and caller authorization are separate controls.
Provide a startup check, meaningful health signal, graceful termination, and structured logs without secrets. Keep durable data in an appropriate external store; do not assume files written to a container's writable layer will survive replacement.
Estimate capacity and cost
Assume load testing established 40 requests/second per ready replica at the desired latency. Peak demand is 130 requests/second. Round up 130 / 40 to four replicas. If only three are ready, usable capacity is 120 requests/second and the model has a 10 requests/second deficit. Startup, connection pools and downstream quotas can prevent linear scaling in real systems.
For an illustrative 30-day month, one replica is billed at a hypothetical $0.04 per replica-hour and three extra replicas run for two hours each day. The base is 720 replica-hours; extra usage is 180 replica-hours. Compute cost is 900 x $0.04 = $36. Add fictional registry storage of $2, networking of $4 and logs of $3 for $45 total. These are teaching rates, not provider prices.
Some consumption services can scale to zero; not all triggers and plans support waking from zero. Azure Container Apps with no ingress, no custom scale rule and no positive minimum can remain at zero. Cloud Run service scaling and billing depend on mode and minimum settings. A warm replica reduces startup delay but can cost money. Include storage, load balancers, NAT, logging, scanning, data transfer and retained artifacts even when application compute is idle. Set budgets and resource bounds; a budget alert is not a guaranteed spending cap.
Diagnose before changing configuration
If the application never starts, inspect whether the image exists at the intended digest, whether the pull identity is authorized, whether DNS and routes reach registry endpoints, and whether the architecture and resource settings fit. If it starts but is unreachable, check port binding, ingress, health and caller identity. If it returns errors only at peak load, inspect ready capacity, request latency, memory and downstream saturation. Do not solve an image pull error by making a registry public, or a request denial by removing authentication.
Practice: choose a private registry and service for a small catalog API and a scheduled batch job. Compute ready capacity and a monthly estimate. Then read Image promotion and runtime identity to make the same release reproducible.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Managed container hosting — knowledge check
Choose the best answer for each offline scenario.
What role does a registry perform?
Which AWS component supplies managed compute for supported ECS tasks?
At 40 requests/second per ready replica, how many are needed for 130 requests/second?
What remains necessary for a private API?
What is true when application replicas scale to zero?