
Docker Fundamentals
Containers, images, Dockerfile, docker-compose, volumes, networks, registries (ECR/GCR/ACR), troubleshooting containers
1What is the main difference between a Docker container and a virtual machine?
What is the main difference between a Docker container and a virtual machine?
답변
A container shares the host operating system kernel and only isolates processes, while a virtual machine includes a complete OS with its own kernel. Containers are therefore much lighter (a few MB vs several GB) and start in seconds instead of minutes. This architectural difference makes containers ideal for rapid deployments and horizontal scalability.
2What is a Docker image?
What is a Docker image?
답변
A Docker image is an immutable, read-only template that contains everything needed to run an application: code, runtime, libraries, environment variables, and configuration files. Images are composed of stacked layers, each layer representing a filesystem modification. This layered architecture enables efficient reuse and sharing of images between containers.
3Which Dockerfile instruction defines the base image?
Which Dockerfile instruction defines the base image?
답변
The FROM instruction defines the base image to build from. It must be the first instruction (after optional ARG) in a Dockerfile. For example, FROM node:18-alpine uses the Node.js 18 image based on Alpine Linux. Choosing an appropriate base image (size, security, compatibility) is crucial for optimizing builds and reducing vulnerabilities.
What is the difference between CMD and ENTRYPOINT in a Dockerfile?
Which Dockerfile instruction copies files from the host to the image?
+21 면접 질문