Latih 80 soalan DevOps merangkumi imej Docker, kontena, volum, rangkaian, Compose, serta workload, perkhidmatan, storan dan penyelesaian masalah Kubernetes.
Tahap: Docker & KubernetesKesukaran: intermediate80 soalan50 min
Baca setiap soalan Docker atau Kubernetes, pilih atau taip jawapan anda, kemudian semak penerangan.
Hari berturut-turut: 0 hariDisimpan hanya pada peranti ini
Kemajuan0 / 80
Masa berbaki: 00:00
Belum ada jawapan salah disimpan.
Tiada soalan sepadan dengan penapis.
Soalan 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.
Soalan 2
Which Dockerfile instruction sets the base image?
FROM names the base image that the build starts from, such as FROM node:20.
Soalan 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.
Soalan 4
Which command builds an image from a Dockerfile?
docker build reads the Dockerfile in the build context and produces an image.
Soalan 5
What does the CMD instruction define?
CMD provides the default command for the container and can be overridden at runtime.
Soalan 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.
Soalan 7
What is a Dockerfile?
A Dockerfile is a text file that contains build instructions such as FROM, COPY, RUN, and CMD.
Soalan 8
What is a Docker container?
A container is a runnable instance of an image, isolated with its own filesystem, processes, and network.
Soalan 9
Which command lists running containers?
docker ps shows running containers; adding -a also shows stopped containers.
Soalan 10
Which command starts a container from an image?
docker run creates and starts a container from an image.
Soalan 11
What does docker pull do?
docker pull downloads an image from a registry such as Docker Hub to the local Docker daemon.
Soalan 12
What is Docker Hub?
Docker Hub is a registry service for sharing and distributing container images.
Soalan 13
Why does Docker use image layers?
Layers allow Docker to reuse cached build steps, reduce storage, and transfer only changed layers.
Soalan 14
What is a Docker volume used for?
Volumes provide persistent storage that remains available after containers are removed or recreated.
Soalan 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.
Soalan 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.
Soalan 17
What is a named volume?
Named volumes are managed by Docker and persist independently of container lifecycle.
Soalan 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.
Soalan 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.
Soalan 20
What is Docker Compose?
Docker Compose defines multi-container applications in YAML and manages them with simple commands.
Soalan 21
Which file is the default Docker Compose file?
Compose looks for docker-compose.yml or compose.yaml by default.
Soalan 22
What does docker compose up do?
docker compose up creates networks and containers for the services and starts them.
Soalan 23
What is a service in Docker Compose?
Each service in a Compose file defines how one container or group of containers should run.
Soalan 24
Which Compose key specifies the image to use?
The image key tells Compose which image to pull or build for the service.
Soalan 25
Which Compose key maps host ports to container ports?
The ports key publishes container ports to the host, for example 8080:80.
Soalan 26
What does docker exec do?
docker exec runs a command inside an already running container, which is useful for debugging.
Soalan 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.
Soalan 28
What is a container registry?
A registry stores images and allows clients to pull and push them.
Soalan 29
Which command tags an image?
docker tag creates a new tag for an image, often used before pushing to a registry.
Soalan 30
Which command uploads an image to a registry?
docker push uploads a locally tagged image to a registry.
Soalan 31
What is a Pod in Kubernetes?
A Pod is the smallest deployable unit in Kubernetes; its containers share network and storage resources.
Soalan 32
Which object maintains a desired number of identical pods?
A ReplicaSet ensures that a specified number of pod replicas are running.
Soalan 33
Which controller manages stateless workloads with rolling updates?
Deployments manage stateless workloads and support rolling updates and rollbacks.
Soalan 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.
Soalan 35
Which controller runs a task to completion?
A Job creates one or more pods and tracks them until they complete successfully.
Soalan 36
Which controller runs scheduled tasks?
A CronJob creates Jobs on a schedule, similar to a cron entry.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 40
What is an Ingress?
Ingress exposes HTTP and HTTPS routes from outside the cluster to services inside it.
Soalan 41
What is a ConfigMap?
ConfigMaps keep configuration data separate from container images so the same image can run in different environments.
Soalan 42
What is a Secret?
Secrets store sensitive data and can be mounted into pods or passed as environment variables.
Soalan 43
Which command applies a Kubernetes manifest?
kubectl apply -f creates or updates resources declared in a YAML manifest.
Soalan 44
Which command lists pods in a cluster?
kubectl get pods lists pods and their status in the current namespace.
Soalan 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.
Soalan 46
What is a namespace in Kubernetes?
Namespaces provide scopes for resources and help organize or isolate cluster objects.
Soalan 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.
Soalan 48
What does a liveness probe check?
A liveness probe tells kubelet when a container is unhealthy and should be restarted.
Soalan 49
What does a readiness probe check?
A readiness probe determines when a pod should receive traffic from a Service.
Soalan 50
What is a PersistentVolumeClaim?
A PersistentVolumeClaim requests storage and binds to an available PersistentVolume.
Soalan 51
Which object defines how storage is provisioned in a cluster?
A StorageClass defines storage provisioners, reclaim policies, and parameters for dynamic volume provisioning.
Soalan 52
What is kubelet?
kubelet runs on each worker node and ensures containers in pods are running and healthy.
Soalan 53
Which components form the Kubernetes control plane?
The control plane includes the API server, scheduler, controller manager, and etcd.
Soalan 54
Which component stores the cluster state?
etcd is the distributed key-value store that holds the cluster state and configuration.
Soalan 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.
Soalan 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.
Soalan 57
What does kubectl rollout status show?
kubectl rollout status reports the progress of a Deployment update until it completes or times out.
Soalan 58
What is RBAC in Kubernetes?
RBAC controls which users and service accounts can perform actions on Kubernetes API resources.
Soalan 59
What is a ServiceAccount?
ServiceAccounts provide an identity for workloads to use when talking to the API server.
Soalan 60
What does an image pull policy control?
imagePullPolicy controls whether the kubelet pulls an image always, only when absent, or never.
Soalan 61
Which of the following are Kubernetes workload controllers?
Deployment, StatefulSet, and DaemonSet are workload controllers; ConfigMap stores configuration data.
Soalan 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.
Soalan 63
Which Docker commands manage images?
build, pull, and push manage images; docker run creates and starts a container from an image.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 67
Which probes can be defined for a container?
Kubernetes supports liveness, readiness, and startup probes; networkProbe is not a built-in probe.
Soalan 68
Which are valid Kubernetes Service types?
ClusterIP, NodePort, and LoadBalancer are Service types; Pod is a workload object, not a Service type.
Soalan 69
Type the Docker command that lists running containers.
docker ps lists running containers; docker ps -a also shows stopped containers.
Soalan 70
Type the kubectl command that applies a manifest file.
kubectl apply -f file.yaml creates or updates resources from a manifest.
Soalan 71
Type the kubectl command that shows logs for a pod named web.
kubectl logs web prints the logs from the pod named web.
Soalan 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.
Soalan 73
Type the kubectl command that shows the status of a Deployment rollout.
kubectl rollout status deployment/name reports the progress of a rollout.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.