teluzia.Cloud Engineer · Day 105
CHAPTER 15 · DOCKER AND CONTAINERS

Week 15 review, recall and recovery

30–90 min including independent practice6 topicsRecall, catch-up, or rest
LET’S MAKE THIS SIMPLE

What you’re learning today

Rebuild and diagnose a local container project. Build a Dockerfile, explain a multi-stage alternative, run a locally published service, demonstrate a named-volume file survives container removal, and inspect Compose rendering. Record image identity, runtime output, retained-volume ownership, and an inactive ECR push/scanning plan. Treat the review as a short evidence-based check: use the existing local lab or paper design, record which outcomes you actually reproduced, and repair one named gap before adding more complexity. Do not create extra billable resources just to prove recall.

Think of it this way

A weekly review is a recovery drill: demonstrate the system, inject one controlled mistake, and explain the evidence that proves repair.

TOPIC 01 / 06Step by step

Images, containers, and processes

An image contains filesystem layers and configuration. A container starts a process from that image with isolation boundaries. Containers share a host kernel rather than each carrying a full independent virtual-machine kernel. Stopping a container stops its process but does not delete the image. For example, two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.

WORKED EXAMPLE
Two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.
Why this matters

Two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.

A common trap

Do not overlook this operational distinction: Stopping a container stops its process but does not delete the image.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Images, containers, and processes

An image contains filesystem layers and configuration. A container starts a process from that image with isolation boundaries. Containers share a host kernel rather than each carrying a full independent virtual-machine kernel. Stopping a container stops its process but does not delete the image. For example, two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.

WORKED EXAMPLE
Two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.

Why this matters

Two containers can start from nginx:alpine while keeping separate writable layers and runtime identities.

A common trap

Do not overlook this operational distinction: Stopping a container stops its process but does not delete the image.

Build context and Dockerfile instructions

The build context supplies files accessible to COPY and related build operations. FROM selects a base, WORKDIR sets a working directory, COPY adds files, and RUN performs build-time work. CMD defines default runtime behavior. These instructions operate at different phases and should not be confused. For example, cOPY app.py /app/app.py occurs during build; CMD ["python","/app/app.py"] is the default process at container start.

WORKED EXAMPLE
COPY app.py /app/app.py occurs during build; CMD ["python","/app/app.py"] is the default process at container start.

Why this matters

COPY app.py /app/app.py occurs during build; CMD ["python","/app/app.py"] is the default process at container start.

A common trap

Do not overlook this operational distinction: These instructions operate at different phases and should not be confused.

Multi-stage build boundaries

Multiple FROM instructions define stages. A final stage can copy selected artifacts from a builder while leaving compilers, source caches, and development tools behind. Stage naming makes copying and targeted builds clearer. The final artifact still needs its necessary runtime libraries and configuration. For example, cOPY --from=builder /out/app /app copies only the built artifact into the runtime stage.

WORKED EXAMPLE
COPY --from=builder /out/app /app copies only the built artifact into the runtime stage.

Why this matters

COPY --from=builder /out/app /app copies only the built artifact into the runtime stage.

A common trap

Do not overlook this operational distinction: The final artifact still needs its necessary runtime libraries and configuration.

Published ports and container networks

Host publication maps a host interface and port to a container port. Containers on a user-defined bridge network can resolve each other by name. localhost inside a container refers to that container, not another service or automatically the host. Exposing metadata is not the same as publishing a host port. For example, a frontend calls http://api:8080 on the shared network, while a host browser uses a published localhost port.

WORKED EXAMPLE
A frontend calls http://api:8080 on the shared network, while a host browser uses a published localhost port.

Why this matters

A frontend calls http://api:8080 on the shared network, while a host browser uses a published localhost port.

A common trap

Do not overlook this operational distinction: Exposing metadata is not the same as publishing a host port.

Services and declarative configuration

Compose defines services, networks, volumes, and settings in a YAML file. Services represent desired containers for one project, with configuration such as image, ports, environment, and mounts. Validate the rendered configuration before startup and use a unique project name to distinguish practice objects. For example, docker compose -p lesson103 config validates and renders the project before docker compose up creates containers.

WORKED EXAMPLE
docker compose -p lesson103 config validates and renders the project before docker compose up creates containers.

Why this matters

docker compose -p lesson103 config validates and renders the project before docker compose up creates containers.

A common trap

Do not overlook this operational distinction: Validate the rendered configuration before startup and use a unique project name to distinguish practice objects.

ECR repository and authentication

ECR stores container images in repositories. Push and pull require appropriate IAM actions and registry authentication. Authentication tokens are temporary; use supported credential mechanisms and least privilege. A repository URI identifies the account, region, repository, and tag or digest, not a running deployment. For example, a pipeline pushes an image to one ECR repository, while a workload role receives only the pull permissions it needs.

WORKED EXAMPLE
A pipeline pushes an image to one ECR repository, while a workload role receives only the pull permissions it needs.

Why this matters

A pipeline pushes an image to one ECR repository, while a workload role receives only the pull permissions it needs.

A common trap

Do not overlook this operational distinction: A repository URI identifies the account, region, repository, and tag or digest, not a running deployment.

KEEP THESE WITH YOU

Today’s takeaways

Images, containers, and processes: An image contains filesystem layers and configuration. A container starts a process from that image with isolation boundaries. Containers share a host kernel rather than each carrying a full independent virtual-machine kernel. Stopping a container stops its process but does not delete the image.

Build context and Dockerfile instructions: The build context supplies files accessible to COPY and related build operations. FROM selects a base, WORKDIR sets a working directory, COPY adds files, and RUN performs build-time work. CMD defines default runtime behavior. These instructions operate at different phases and should not be confused.

Multi-stage build boundaries: Multiple FROM instructions define stages. A final stage can copy selected artifacts from a builder while leaving compilers, source caches, and development tools behind. Stage naming makes copying and targeted builds clearer. The final artifact still needs its necessary runtime libraries and configuration.

Published ports and container networks: Host publication maps a host interface and port to a container port. Containers on a user-defined bridge network can resolve each other by name. localhost inside a container refers to that container, not another service or automatically the host. Exposing metadata is not the same as publishing a host port.

Services and declarative configuration: Compose defines services, networks, volumes, and settings in a YAML file. Services represent desired containers for one project, with configuration such as image, ports, environment, and mounts. Validate the rendered configuration before startup and use a unique project name to distinguish practice objects.

ECR repository and authentication: ECR stores container images in repositories. Push and pull require appropriate IAM actions and registry authentication. Authentication tokens are temporary; use supported credential mechanisms and least privilege. A repository URI identifies the account, region, repository, and tag or digest, not a running deployment.

CLOSE THE LOOP

Ready to complete this day?

Verify your recall or recovery steps, then finish this review day.

Lab steps verifiedReview day: quiz optional