Full-Stack Development Full-Stack Development DevOps, CI/CD & Cloud Deployment 1 — Questions and Answers
Question 1: What is the primary purpose of Docker in a full-stack development workflow?
- To manage DNS records for deployed applications
- To package an application and its dependencies into portable containers that run consistently across environments (Correct answer)
- To compile TypeScript into JavaScript
- To monitor application performance in production
Correct answer: To package an application and its dependencies into portable containers that run consistently across environments
Docker containers bundle the application code with all its runtime dependencies, eliminating 'works on my machine' problems by running identically in dev, staging, and production.
Question 2: What is the difference between a Docker image and a Docker container?
- Images run in the cloud; containers run locally
- An image is a static blueprint; a container is a running instance of that image (Correct answer)
- Images store data; containers store code
- Images are for Linux; containers are for Windows
Correct answer: An image is a static blueprint; a container is a running instance of that image
A Docker image is an immutable snapshot of the filesystem and configuration, while a container is a live, running process created from that image.
Question 3: What does `docker-compose up` do?
- Uploads images to Docker Hub
- Starts all services defined in a docker-compose.yml file as a multi-container application (Correct answer)
- Updates Docker to the latest version
- Scales a single container to multiple replicas
Correct answer: Starts all services defined in a docker-compose.yml file as a multi-container application
docker-compose up reads the docker-compose.yml file and starts all defined services (e.g., app + database + cache) together with their configured networking and volumes.
Question 4: What is Kubernetes primarily used for?
- Building Docker images from Dockerfiles
- Orchestrating, scaling, and managing containerized applications across a cluster of machines (Correct answer)
- Monitoring application logs and metrics
- Providing a container image registry
Correct answer: Orchestrating, scaling, and managing containerized applications across a cluster of machines
Kubernetes automates deployment, scaling, load balancing, and self-healing of containerized workloads across multiple nodes in a cluster.
Question 5: What is the purpose of a `.dockerignore` file?
- To specify which containers Docker should not start
- To exclude files and directories from being copied into the Docker image during the build (Correct answer)
- To ignore Docker version warnings
- To block certain Docker commands from running
Correct answer: To exclude files and directories from being copied into the Docker image during the build
.dockerignore works like .gitignore, preventing files like node_modules or .env from being included in the build context sent to the Docker daemon, keeping images smaller and more secure.
Question 6: In a Dockerfile, what does the `EXPOSE` instruction do?
- Opens a port on the host machine
- Documents which port the containerized application listens on, used as metadata for networking configuration (Correct answer)
- Automatically publishes the container port to the host
- Encrypts network traffic on the specified port
Correct answer: Documents which port the containerized application listens on, used as metadata for networking configuration
EXPOSE is documentation — it tells Docker and operators which port the app uses, but actual port mapping to the host requires the -p flag when running the container.
What is the primary purpose of Docker in a full-stack development workflow?