Discover how to build, containerize, and deploy applications with Dockerfiles and Kubernetes, including core commands and deployment steps for beginners. This quiz covers foundational concepts and practical tasks in setting up cloud-native workflows.
Which Dockerfile instruction is used to specify the base image for building a new container image?
Explanation: The FROM instruction defines the base image from which to start building the new Docker image. RUN executes commands during the build process, CMD sets the default command for the container, and COPY moves files from your local machine into the image; none of these set the base image.
What is the purpose of the EXPOSE command in a Dockerfile that sets up a Node.js app to listen on port 3000?
Explanation: EXPOSE indicates to Docker which port the application inside the container expects traffic on. It does not directly open ports on the host (option B), start applications (C), or forward requests to the host OS (D).
Why is it important to push a Docker image to a container registry before deploying it in Kubernetes?
Explanation: Kubernetes clusters typically require container images to be available from a central registry so that all nodes can pull and run the image. Kubernetes does not build images automatically (B), nor are local images visible on all nodes (C), and registries do not execute code (D).
Which section of a Kubernetes deployment YAML defines the container image and exposed port for a Node.js app?
Explanation: The spec.containers section lists the container images to use, as well as configuration such as exposed ports. metadata.labels define labels for selection, replicas determines the number of pod copies, and apiVersion specifies resource versioning.
What is the role of a Kubernetes Service of type LoadBalancer when exposing a deployed application?
Explanation: A Service of type LoadBalancer assigns an external IP and routes incoming traffic to the correct pods. It does not manage storage (B), scale pods (C), or build images from Dockerfiles (D).