1. LPU MCA Semester 1
  2. CAP470
  3. Unit 4

CAP470 · Unit 4: Containers

Container core concepts and use cases

10 practice questions · in the MTE and ETE syllabus

Key points

  • Immutable images give consistent releases
  • Microservices and CI/CD are classic use cases
  • Keep state in volumes, not the writable layer
  • A different kernel needs a VM

A container image is built from a Dockerfile, a text recipe with steps such as FROM, COPY and RUN. The same immutable image is promoted from test to production, so behaviour is consistent across environments.

Use cases: microservices (an application built from small independent services, each often in its own container), CI/CD pipelines (build an image, test in it, deploy the same image), batch jobs, and moving legacy applications with little change by packaging the monolith in one container and splitting services later.

Containers suit stateless, scalable services. Persistent data should live in volumes or external stores, because the container's writable layer is lost on removal.

Limits: containers share the host kernel, so a workload needing a different kernel, such as a Windows application on a Linux host, needs a VM. A shared kernel also means a kernel vulnerability can affect every container on the host.

Exam trap: containers are lightweight isolation, not a replacement for VMs in every case.

Try two questions

Question 1 · Tier 3, Apply

A CI/CD pipeline builds a container image, runs tests in it and then deploys the same image. Which advantage does this show?

  1. Automatic removal of the need for any tests
  2. Consistent, repeatable releases
  3. A separate hardware server for each stage
  4. A guarantee that the code has no bugs
Show the answer

B. The image tested is the image deployed, which reduces surprises between environments.

Why not A: Tests are still needed.

Why not C: Containers do not require separate hardware per stage.

Why not D: Testing in a container does not guarantee absence of bugs.

Question 2 · Tier 4, Analyse

Which workload is a poor fit for containers when it needs a different operating system kernel from the host?

  1. A stateless Linux web service on a Linux host
  2. A batch job that runs a Python script on Linux
  3. A Windows app that must run on a Linux kernel
  4. A small API service built as a microservice
Show the answer

C. Containers share the host kernel, so a different kernel needs a VM.

Why not A: A Linux service on a Linux host is a good fit for containers.

Why not B: This fits containers well.

Why not D: This fits containers well.