Luyện tập 80 câu hỏi DevOps về image Docker, container, volume, mạng, Compose, và workload, dịch vụ, lưu trữ, xử lý sự cố Kubernetes.
Cấp độ: Docker & KubernetesĐộ khó: intermediate80 câu hỏi50 phút
Đọc từng câu hỏi Docker hoặc Kubernetes, chọn hoặc nhập câu trả lời, sau đó xem lời giải.
Chuỗi ngày: 0 ngàyChỉ lưu trên thiết bị này
Tiến độ0 / 80
Thời gian còn lại: 00:00
Chưa có câu sai được lưu.
Không có câu hỏi phù hợp với bộ lọc.
Câu hỏi 1
What does a Docker image contain?
A Docker image packages application code together with the runtime, libraries, and configuration as layered filesystem snapshots. It does not include a separate OS kernel.
Câu hỏi 2
Which Dockerfile instruction sets the base image?
FROM names the base image that the build starts from, such as FROM node:20.
Câu hỏi 3
Which Dockerfile instruction copies files from the build context into the image?
COPY copies files or directories from the build context into the image filesystem.
Câu hỏi 4
Which command builds an image from a Dockerfile?
docker build reads the Dockerfile in the build context and produces an image.
Câu hỏi 5
What does the CMD instruction define?
CMD provides the default command for the container and can be overridden at runtime.
Câu hỏi 6
What does the ENTRYPOINT instruction define?
ENTRYPOINT defines the main executable that runs when the container starts and is harder to override than CMD.
Câu hỏi 7
What is a Dockerfile?
A Dockerfile is a text file that contains build instructions such as FROM, COPY, RUN, and CMD.
Câu hỏi 8
What is a Docker container?
A container is a runnable instance of an image, isolated with its own filesystem, processes, and network.
Câu hỏi 9
Which command lists running containers?
docker ps shows running containers; adding -a also shows stopped containers.
Câu hỏi 10
Which command starts a container from an image?
docker run creates and starts a container from an image.
Câu hỏi 11
What does docker pull do?
docker pull downloads an image from a registry such as Docker Hub to the local Docker daemon.
Câu hỏi 12
What is Docker Hub?
Docker Hub is a registry service for sharing and distributing container images.
Câu hỏi 13
Why does Docker use image layers?
Layers allow Docker to reuse cached build steps, reduce storage, and transfer only changed layers.
Câu hỏi 14
What is a Docker volume used for?
Volumes provide persistent storage that remains available after containers are removed or recreated.
Câu hỏi 15
Which flag is commonly used to mount a volume or bind mount?
The -v or --volume flag mounts a volume or host directory into the container.
Câu hỏi 16
What is a bind mount?
A bind mount maps a directory on the host into a container path, so the container sees host files directly.
Câu hỏi 17
What is a named volume?
Named volumes are managed by Docker and persist independently of container lifecycle.
Câu hỏi 18
Which Docker network driver creates an isolated network for containers on one host?
The bridge driver creates a private network on the host so containers can communicate through it.
Câu hỏi 19
Which Docker network driver lets containers use the host network stack directly?
The host driver removes network isolation and attaches containers directly to the host network.
Câu hỏi 20
What is Docker Compose?
Docker Compose defines multi-container applications in YAML and manages them with simple commands.
Câu hỏi 21
Which file is the default Docker Compose file?
Compose looks for docker-compose.yml or compose.yaml by default.
Câu hỏi 22
What does docker compose up do?
docker compose up creates networks and containers for the services and starts them.
Câu hỏi 23
What is a service in Docker Compose?
Each service in a Compose file defines how one container or group of containers should run.
Câu hỏi 24
Which Compose key specifies the image to use?
The image key tells Compose which image to pull or build for the service.
Câu hỏi 25
Which Compose key maps host ports to container ports?
The ports key publishes container ports to the host, for example 8080:80.
Câu hỏi 26
What does docker exec do?
docker exec runs a command inside an already running container, which is useful for debugging.
Câu hỏi 27
Which command shows logs from a container?
docker logs prints the logs produced by a container. It is the standard command for viewing stdout and stderr output from a running or stopped container. docker ps lists containers, docker pull downloads images, and docker inspect shows detailed configuration rather than logs.
Câu hỏi 28
What is a container registry?
A registry stores images and allows clients to pull and push them.
Câu hỏi 29
Which command tags an image?
docker tag creates a new tag for an image, often used before pushing to a registry.
Câu hỏi 30
Which command uploads an image to a registry?
docker push uploads a locally tagged image to a registry.
Câu hỏi 31
What is a Pod in Kubernetes?
A Pod is the smallest deployable unit in Kubernetes; its containers share network and storage resources.
Câu hỏi 32
Which object maintains a desired number of identical pods?
A ReplicaSet ensures that a specified number of pod replicas are running.
Câu hỏi 33
Which controller manages stateless workloads with rolling updates?
Deployments manage stateless workloads and support rolling updates and rollbacks.
Câu hỏi 34
Which controller runs one pod on every node?
DaemonSets ensure a copy of a pod runs on every eligible node, which is useful for logging and monitoring agents.
Câu hỏi 35
Which controller runs a task to completion?
A Job creates one or more pods and tracks them until they complete successfully.
Câu hỏi 36
Which controller runs scheduled tasks?
A CronJob creates Jobs on a schedule, similar to a cron entry.
Câu hỏi 37
Which controller is best for stateful applications with stable network identity?
StatefulSets provide stable pod identities, ordered deployment, and persistent storage for stateful apps.
Câu hỏi 38
What does a Kubernetes Service do?
A Service gives pods a stable virtual IP and DNS name and load balances traffic to matching pods.
Câu hỏi 39
Which Service type exposes a service through a cloud load balancer?
LoadBalancer provisions an external load balancer and assigns the service an external IP.
Câu hỏi 40
What is an Ingress?
Ingress exposes HTTP and HTTPS routes from outside the cluster to services inside it.
Câu hỏi 41
What is a ConfigMap?
ConfigMaps keep configuration data separate from container images so the same image can run in different environments.
Câu hỏi 42
What is a Secret?
Secrets store sensitive data and can be mounted into pods or passed as environment variables.
Câu hỏi 43
Which command applies a Kubernetes manifest?
kubectl apply -f creates or updates resources declared in a YAML manifest.
Câu hỏi 44
Which command lists pods in a cluster?
kubectl get pods lists pods and their status in the current namespace.
Câu hỏi 45
Which command shows logs from a pod?
kubectl logs prints container logs from a pod. It is the standard Kubernetes command for troubleshooting application output. kubectl describe image is not a valid command, kubectl exec runs commands inside a container, and kubectl get events lists cluster events instead of pod logs.
Câu hỏi 46
What is a namespace in Kubernetes?
Namespaces provide scopes for resources and help organize or isolate cluster objects.
Câu hỏi 47
Where are CPU and memory limits for a container defined?
Container resource requests and limits are defined in the container resources field of a pod spec.
Câu hỏi 48
What does a liveness probe check?
A liveness probe tells kubelet when a container is unhealthy and should be restarted.
Câu hỏi 49
What does a readiness probe check?
A readiness probe determines when a pod should receive traffic from a Service.
Câu hỏi 50
What is a PersistentVolumeClaim?
A PersistentVolumeClaim requests storage and binds to an available PersistentVolume.
Câu hỏi 51
Which object defines how storage is provisioned in a cluster?
A StorageClass defines storage provisioners, reclaim policies, and parameters for dynamic volume provisioning.
Câu hỏi 52
What is kubelet?
kubelet runs on each worker node and ensures containers in pods are running and healthy.
Câu hỏi 53
Which components form the Kubernetes control plane?
The control plane includes the API server, scheduler, controller manager, and etcd.
Câu hỏi 54
Which component stores the cluster state?
etcd is the distributed key-value store that holds the cluster state and configuration.
Câu hỏi 55
What is a node in Kubernetes?
A node is a worker machine, physical or virtual, that runs pods through a container runtime and kubelet.
Câu hỏi 56
What does the Horizontal Pod Autoscaler do?
The Horizontal Pod Autoscaler changes the number of pod replicas based on metrics such as CPU utilization.
Câu hỏi 57
What does kubectl rollout status show?
kubectl rollout status reports the progress of a Deployment update until it completes or times out.
Câu hỏi 58
What is RBAC in Kubernetes?
RBAC controls which users and service accounts can perform actions on Kubernetes API resources.
Câu hỏi 59
What is a ServiceAccount?
ServiceAccounts provide an identity for workloads to use when talking to the API server.
Câu hỏi 60
What does an image pull policy control?
imagePullPolicy controls whether the kubelet pulls an image always, only when absent, or never.
Câu hỏi 61
Which of the following are Kubernetes workload controllers?
Deployment, StatefulSet, and DaemonSet are workload controllers; ConfigMap stores configuration data.
Câu hỏi 62
Which fields commonly appear in a Service manifest?
Services use selector, ports, and type; the image field belongs to a container or pod spec.
Câu hỏi 63
Which Docker commands manage images?
build, pull, and push manage images; docker run creates and starts a container from an image.
Câu hỏi 64
Which of the following are valid ways to persist data in Docker?
Named volumes, bind mounts, and tmpfs mounts are storage options; overlay is a network driver.
Câu hỏi 65
Which components are part of the Kubernetes control plane?
The API server, scheduler, and etcd are control-plane components; kubelet runs on worker nodes.
Câu hỏi 66
Which commands help debug a failing pod?
describe, logs, and exec provide details about a pod; docker push uploads images and does not debug pods.
Câu hỏi 67
Which probes can be defined for a container?
Kubernetes supports liveness, readiness, and startup probes; networkProbe is not a built-in probe.
Câu hỏi 68
Which are valid Kubernetes Service types?
ClusterIP, NodePort, and LoadBalancer are Service types; Pod is a workload object, not a Service type.
Câu hỏi 69
Type the Docker command that lists running containers.
docker ps lists running containers; docker ps -a also shows stopped containers.
Câu hỏi 70
Type the kubectl command that applies a manifest file.
kubectl apply -f file.yaml creates or updates resources from a manifest.
Câu hỏi 71
Type the kubectl command that shows logs for a pod named web.
kubectl logs web prints the logs from the pod named web.
Câu hỏi 72
Type the Docker command used to run a command inside a running container.
docker exec runs a command inside a running container. It is commonly used for debugging, inspecting files, or launching an interactive shell. The answer should be docker exec because that is the Docker command for this task.
Câu hỏi 73
Type the kubectl command that shows the status of a Deployment rollout.
kubectl rollout status deployment/name reports the progress of a rollout.
Câu hỏi 74
Type the Kubernetes object that provides a stable network name for pods.
A Service provides a stable virtual IP and DNS name for a set of pods.
Câu hỏi 75
Match each Docker command to what it does.
build creates images, run starts containers, push uploads images, and exec runs commands inside running containers.
Câu hỏi 76
Match each Kubernetes object to its purpose.
Deployments manage stateless apps, StatefulSets manage stateful apps, DaemonSets run pods on every node, and CronJobs run scheduled jobs.
Câu hỏi 77
Match each Dockerfile instruction to its purpose.
FROM sets the base, COPY adds files, CMD sets the default command, and EXPOSE documents a port.
Câu hỏi 78
Match each Kubernetes object to its role.
ConfigMaps store config, Secrets store sensitive values, Services provide stable endpoints, and Ingress routes external HTTP traffic.
Câu hỏi 79
Match each kubectl command to what it does.
get lists resources, describe shows details, logs prints logs, and exec runs commands in a container.
Câu hỏi 80
Match each storage concept to its definition.
A PersistentVolume is cluster storage, a PVC requests it, a StorageClass defines provisioning, and a Volume is the pod-level mount source.