# Containers

Containers package applications and their dependencies into isolated processes that run using a compatible host operating-system kernel.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/containers

> Containers provide a repeatable way to build, distribute, and run software across development and cloud environments. They improve deployment consistency and resource utilization, but require explicit controls for image security, runtime isolation, networking, identity, and persistent data.

Practice exams covering Containers: [CLF-C02 AWS Certified Cloud Practitioner](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner), [DEA-C01 AWS Certified Data Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate), [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [AIP-C01 AWS Certified Generative AI Developer - Professional](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional), [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SCS-C03 AWS Certified Security - Specialty](https://blowstack.com/practice-exams/aws-certified-security-specialty), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Containers

Containers combine repeatable packaging and efficient execution with explicit responsibilities for orchestration, isolation, image security, host maintenance, and persistent state.

1. **Repeatable application packaging**: An image packages application code, dependencies, and execution metadata into a reusable artifact. Promote the same tested image through environments and use its digest to identify the exact version deployed.
2. **Operating-system-level isolation**: Containers isolate processes while typically sharing the host kernel. Treat privileged execution, host filesystem mounts, and excessive capabilities as significant reductions in that isolation.
3. **Orchestration separate from compute**: An orchestrator schedules containers and maintains desired workload state, while compute capacity provides the resources on which they run. Choose the orchestration interface separately from the decision to manage hosts or use managed compute.
4. **Hardened images and hosts**: Minimize image contents, scan dependencies, exclude secrets, and rebuild images when vulnerabilities are fixed. For self-managed worker instances, also harden and patch the host operating system and container runtime.
5. **Least-privilege runtime configuration**: Use workload-specific permissions, non-root execution, restricted networking, and resource limits. Avoid unnecessary privileges and protect credentials independently of the image.
6. **Replaceable execution with explicit persistence**: Design containers to be stopped and replaced without losing required application state. Store durable data outside the disposable container filesystem and configure health checks and graceful shutdown behavior.

## Cloud services for Containers

EC2 Image Builder can produce hardened container images and AMIs for EC2-backed container hosts. Amazon ECR stores the resulting container images for deployment by Amazon ECS or Amazon EKS. ECS provides AWS-native orchestration, while EKS provides Kubernetes orchestration. Both can use supported AWS Fargate configurations to reduce host-management responsibilities, or EC2 capacity when greater host control is required. AWS Systems Manager helps manage and patch EC2 hosts. Together, these services support a controlled build-to-runtime workflow, but engineers must still enforce image approval, least-privilege access, secure runtime settings, and timely workload replacement.

- **[AWS Fargate](https://blowstack.com/tools/cloud-services-hub/aws-fargate)**: Fargate provides managed compute for supported ECS and EKS workloads without requiring customers to administer worker instances. Image security, application permissions, and workload configuration remain customer responsibilities.
- **[EC2 Image Builder](https://blowstack.com/tools/cloud-services-hub/ec2-image-builder)**: EC2 Image Builder automates building, customizing, testing, and distributing AMIs and container images. Use repeatable pipelines to apply hardening steps and validate artifacts before deployment.
- **[AWS Systems Manager](https://blowstack.com/tools/cloud-services-hub/aws-systems-manager)**: Systems Manager supports management of EC2 container hosts through capabilities such as configuration automation, Session Manager, and Patch Manager. Use it for host-level controls; update application dependencies by rebuilding and redeploying container images.

## Containers exam questions

Real practice exam questions on Containers, with the correct answer and its explanation.

### Question 1 (CLF-C02)

**Question:**

A software vendor wants to publish an open-source application as a container image. Customers must be able to discover the image in a public catalog and pull it without signing in, whether they run containers on AWS or in their own data centers. The vendor does not need to run the application for customers. Which solution best meets these requirements?

**Correct answer:** Publish the image in an Amazon ECR Public repository.

**Explanation:** Amazon ECR Public stores and distributes publicly accessible container images. Customers can discover images through the ECR Public Gallery and pull them without authentication for use on AWS or elsewhere.

### Question 2 (MLA-C02 (beta))

**Question:**

A software company maintains 120 tenant-specific CPU-based classification models in Amazon S3. All models use the same framework and are compatible with the same SageMaker AI inference image, which supports dynamic model loading. Only a small subset of models receives requests at any given time, and their combined size exceeds the memory of an endpoint instance. Occasional additional latency when a model is first requested is acceptable.

The company wants the models to share a SageMaker AI endpoint fleet. Hosting must automatically load requested models and evict infrequently used models when memory is needed, without custom model-management code. The application knows which model each request requires.

Which deployment configuration meets these requirements?

**Correct answer:** Create a multi-model endpoint with the inference container configured in MultiModel mode and an S3 prefix containing the model artifacts. Specify the selected artifact through TargetModel in each invocation.

**Explanation:** A SageMaker AI multi-model endpoint shares serving resources across compatible models. It loads requested model artifacts on demand, caches loaded models, and unloads models when memory is needed. TargetModel identifies the artifact to invoke, and occasional model-loading latency is consistent with the requirements.

### Question 3 (SAP-C03)

**Question:**

A publisher is replatforming an on-premises document-management application to AWS. The application runs as several Linux web-server processes and uses native libraries that the company can package with the application. All replicas access the same directory tree of uploaded documents. The application uses POSIX file operations and advisory file locks to coordinate updates, and it flushes changes before acknowledging writes. Testing has confirmed compatibility with an NFSv4.1 shared filesystem.

The company must run replicas across multiple Availability Zones without administering compute hosts. Acknowledged document updates must survive replacement of all application replicas and remain accessible to other replicas through the shared filesystem. The migration must preserve the application's file-access logic and must not require converting the application to an event-driven model.

Which replatforming design meets these requirements?

**Correct answer:** Package the application and libraries in a container image. Run an Amazon ECS service on AWS Fargate across multiple Availability Zones. Mount an Amazon EFS filesystem at the application's document directory in every task, with mount targets in the participating Availability Zones.

**Explanation:** The image provides a repeatable application environment, while ECS with Fargate removes compute-host administration. EFS supplies persistent, shared NFS storage with the required filesystem and locking behavior. Documents remain independent of task lifecycles and accessible to replicas across Availability Zones.

### Question 4 (DEA-C01)

**Question:**

A company runs containerized data-transformation workers and general-purpose application pods on an Amazon EKS cluster. During large transformations, contention from application pods causes workers to miss processing deadlines. The company creates a new memory-optimized EC2 managed node group with the label workload=transform. No other nodes have this label.

The company must ensure that transformation workers run only on the new node group and that general-purpose application pods cannot be scheduled there. General-purpose application pods have no node placement constraints or taint tolerations. Both workloads must remain in the same cluster.

Which configuration meets these requirements?

**Correct answer:** Add a workload=transform:NoSchedule taint to the new node group. Give transformation worker pods a matching toleration and a nodeSelector for workload=transform.

**Explanation:** The nodeSelector restricts transformation workers to the labeled node group. The matching toleration allows workers to use the tainted nodes, while the NoSchedule taint prevents general-purpose application pods without that toleration from being scheduled there.

### Question 5 (AIP-C01)

**Question:**

A company runs an LLM inference Deployment on Amazon EKS with four replicas. Each pod exclusively requests one GPU, and the cluster has exactly four allocatable GPUs. All four GPUs are occupied. The company cannot add GPU capacity or share GPUs between pods. Three ready replicas can handle peak traffic during an update.

A new container version starts its HTTP listener within 5 seconds but requires up to 6 minutes to load model weights and initialize GPU kernels. A model-readiness endpoint returns success only after initialization and a successful warm-up inference. A separate process-health endpoint responds successfully throughout initialization.

The developer must configure rolling updates so that they complete automatically, maintain at least three ready replicas, and never route inference requests to a pod that is still initializing.

Which configuration meets these requirements?

**Correct answer:** Set maxSurge to 0 and maxUnavailable to 1. Configure a startup probe against the model-readiness endpoint with a 10-minute failure budget, a readiness probe against the model-readiness endpoint, and a liveness probe against the process-health endpoint.

**Explanation:** The rollout can remove one old pod to release a GPU while retaining three ready replicas. The replacement must finish model initialization before readiness allows traffic. The startup probe accommodates the loading interval and prevents liveness checks from interfering with startup. Once the replacement is ready, the rollout can replace the next old pod.

### Question 6 (SCS-C03)

**Question:**

A company builds a Linux container image for a compiled application. The build downloads private dependencies by using a repository token. The Dockerfile copies the token into the image, compiles the application, and deletes the token and compiler in a later instruction. A security review recovers the token from the published image and finds that the image still includes substantial build-tool content.

The company requires published images to contain neither the build credential nor the build toolchain. The application must also start without root privileges. The application needs only its compiled executable and a documented set of runtime libraries; it does not need the repository token at runtime.

Which build design meets these requirements?

**Correct answer:** Use a multi-stage build. Supply the token to the dependency-download instruction through a BuildKit secret mount without writing it into build outputs. Copy only the executable and required runtime libraries into a minimal final stage, and configure that stage to run as a non-root user.

**Explanation:** The secret mount makes the token available during the required build instruction without incorporating it into an image layer. A separate final stage that receives only explicitly selected runtime artifacts excludes the build toolchain and builder filesystem. Configuring a non-root user in the final stage establishes the required default execution identity.

### Question 7 (SAA-C03)

**Question:**

A company runs a stateless application as an Amazon ECS service on EC2 instances. The cluster has four identical container instances in each of three Availability Zones. Every instance has enough available resources to run several application tasks. The service must maintain six replicas. To limit the impact of infrastructure failures, the company requires that no two replicas of this service run on the same container instance. The scheduler must also balance the replicas across Availability Zones when sufficient capacity is available. Which service configuration meets these requirements?

**Correct answer:** Use the REPLICA scheduling strategy with a desired count of six. Apply a distinctInstance placement constraint and a spread placement strategy on attribute:ecs.availability-zone.

**Explanation:** The distinctInstance constraint prevents tasks in this service from sharing a container instance. The Availability Zone spread strategy directs ECS to distribute the service's tasks evenly across the three zones. The desired count maintains six replicas, and the available instances allow both placement requirements to be satisfied.

### Question 8 (DOP-C02)

**Question:**

A company runs containerized video-processing workers as an Amazon ECS service on AWS Fargate. Each task processes one Amazon SQS message at a time. A job takes up to 45 minutes, and intermediate results remain in the task's writable container layer until the completed output is uploaded to Amazon S3. Interrupted jobs can be retried, but restarting them wastes significant processing time.

An existing scaling policy increases the service's desired count when the queue grows and decreases it when demand falls. During scale-in, ECS sometimes stops tasks that are still processing jobs. The company must prevent service scale-in from terminating busy tasks while allowing idle tasks to be removed automatically. The worker code can be modified. Infrastructure failures and Spot interruptions are outside the scope of this requirement.

Which solution should a DevOps engineer implement?

**Correct answer:** Before polling for a message, have the worker enable ECS task scale-in protection through the ECS agent endpoint with a 60-minute expiration. Clear protection if the poll returns no message, or after the completed output is uploaded and the message is deleted. Repeat this sequence for each job.

**Explanation:** ECS task scale-in protection prevents service scale-in from terminating protected tasks. Enabling protection before polling avoids acquiring a job before protection is active. The 60-minute protection period covers the maximum job duration, and clearing protection after an empty poll or completed job allows idle capacity to be removed. The expiration also prevents protection from remaining indefinitely if worker cleanup fails.

## Practice Containers in a full exam

Questions on Containers in each practice exam, with every answer option and an explanation for each:

- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 16 questions
- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 11 questions
- [AIP-C01](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional): 8 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 4 questions
- [CLF-C02](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner): 3 questions
- [DEA-C01](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate): 2 questions
- [SCS-C03](https://blowstack.com/practice-exams/aws-certified-security-specialty): 2 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 1 question
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 1 question

## What is Containers

A container is a running instance of a container image: a packaged application filesystem with dependencies and execution metadata. Unlike a virtual machine, a typical container does not boot its own operating-system kernel. Instead, the container runtime uses host operating-system isolation mechanisms to separate processes, filesystems, and resource consumption. On Linux, namespaces provide isolation and control groups govern resources. This shared-kernel model generally allows containers to start quickly and use fewer resources than separate virtual machines.

Images make application delivery repeatable. For example, a team can build an image containing a web API and its required libraries, test it in a pipeline, publish it to a registry, and deploy the same image to production. Portability still has limits: the image must match the supported operating system and processor architecture, and the application may depend on external networking, storage, or cloud APIs. A container image is not the same as an Amazon Machine Image, or AMI. An AMI supplies an EC2 instance's operating-system environment; a container image supplies the application environment executed by a container runtime.

Cloud deployments normally combine a registry, an orchestrator, and compute capacity. The registry stores images, while the orchestrator schedules workloads, maintains the desired number of replicas, and coordinates updates and recovery. Amazon ECS is an AWS-native container orchestration option. Amazon EKS provides managed Kubernetes for teams that need Kubernetes APIs, tooling, or ecosystem integrations. AWS Fargate supplies managed compute for supported ECS and EKS workloads, removing the need to administer the underlying worker instances. ECS and EKS can also use EC2 capacity when workloads require greater host control or particular instance capabilities.

Choose containers for independently deployable APIs, background workers, batch jobs, or applications with conflicting dependency requirements. For example, an API service can scale separately from a queue-processing worker even when both use the same application image with different startup commands. Containers do not automatically make an application stateless: data in a container's writable layer is normally lost when that container is removed. Put durable data in an appropriate database, object store, or persistent volume, and design applications to tolerate replacement.

Image hardening begins during the build. Use maintained, minimal base images, remove unnecessary packages and build tools, install security updates, and run the application as a non-root user where supported. Use multistage builds to keep compilation dependencies out of the final image. Never bake credentials into image layers; deleting a secret in a later layer does not remove it from earlier layers. Scan operating-system packages and application dependencies, verify image provenance, and deploy approved images by digest to identify exact artifacts. A clean vulnerability scan is not proof that an image is secure.

Runtime controls are equally important. Avoid privileged containers and unnecessary host mounts, drop unneeded Linux capabilities, restrict network access, set CPU and memory limits, and use read-only root filesystems where practical. Give each workload narrowly scoped permissions rather than broad access through the host's identity. Because ordinary containers share a kernel, they are not equivalent to virtual machines as a security boundary. Stronger isolation may be necessary for mutually untrusted workloads.

For EC2-backed container hosts, harden the AMI, restrict administrative access, and maintain the kernel, runtime, and host agents. EC2 Image Builder can automate creation and testing of hardened AMIs and container images. AWS Systems Manager can support configuration, controlled administrative access, and patching of managed EC2 hosts; it does not replace rebuilding vulnerable application images. Patch container dependencies by rebuilding, testing, and redeploying images rather than manually changing running containers. Managed compute reduces host administration, but customers still remain responsible for their application code, images, permissions, and workload configuration.

## Learn Containers in lessons

13 short lessons on Containers in 8 certification courses.

- CLF-C02: Containers: running applications with orchestration (Premium), https://app.blowstack.com/lessons/containers-running-applications-with-orchestration-clf-c02
- MLA-C02 (beta): Containers: packaging ML workloads into images (Premium), https://app.blowstack.com/lessons/containers-packaging-ml-workloads-into-images-mla-c02
- SAP-C03: Containers: runtime portability on managed compute (Premium), https://app.blowstack.com/lessons/containers-runtime-portability-on-managed-compute-sap-c03
- DEA-C01: Containers: CPU and memory sizing (Premium), https://app.blowstack.com/lessons/containers-cpu-and-memory-sizing-dea-c01
- AIP-C01: Containers: resource-aware LLM serving (Premium), https://app.blowstack.com/lessons/containers-resource-aware-llm-serving-aip-c01
- SCS-C03: Containers: hardened image builds (Premium), https://app.blowstack.com/lessons/containers-hardened-image-builds-scs-c03
