Free DCA Exam Braindumps
Docker Certified Associate Questions 46–50 (page: 11)

Updated On: 10-Feb-2026

Does this command display all the pods in the cluster that are labeled as 'env: development'?

Solution: 'kubectl get pods --all-namespaces -label env=development'

  1. Yes
  2. No

Answer(s): B

Explanation:

= The command kubectl get pods --all-namespaces -label env=development is not valid because it has a syntax error. The correct syntax for listing pods with a specific label is kubectl get pods --all- namespaces --selector label=value or kubectl get pods --all-namespaces -l label=value. The error in the command is:

The option flag for specifying the label selector is --selector or -l, not -label. For example, -label env=development should be --selector env=development or -l env=development.

The correct command for listing all the pods in the cluster that are labeled as env: development is:

kubectl get pods --all-namespaces --selector env=development

This command will display the name, status, restarts, and age of the pods that have the label env:
development in all namespaces.


Reference:

: Labels | Kube by Example : kubectl Cheat Sheet | Kubernetes



Does this command display all the pods in the cluster that are labeled as 'env: development'?

Solution: 'kubectl get pods --all-namespaces -I env=development'

  1. Yes
  2. No

Answer(s): B

Explanation:

The command `kubectl get pods --all-namespaces -I env=development' does not display all the pods in the cluster that are labeled as `env: development'. The reason is that the flag -I is not a valid option for kubectl get pods. The correct flag to use is --selector or -l, which allows you to filter pods by labels. Labels are key-value pairs that can be attached to Kubernetes objects to identify, group, or select them. For example, to label a pod with env=development, one can run:

kubectl label pods my-pod env=development

To display all the pods that have the label env=development, one can run:

kubectl get pods --selector env=development or kubectl get pods -l env=development

The --all-namespaces flag can be used to list pods across all namespaces. Therefore, the correct command to display all the pods in the cluster that are labeled as `env: development' is:

kubectl get pods --all-namespaces --selector env=development or kubectl get pods --all-namespaces -l env=development


Reference:

kubectl Cheat Sheet | Kubernetes

Labels and Selectors | Kubernetes kubectl get | Kubernetes



Will this command display a list of volumes for a specific container?

Solution: 'docker container inspect nginx'

  1. Yes
  2. No

Answer(s): A

Explanation:

= The command docker container inspect nginx will display a list of volumes for the specific container named nginx. The output of the command will include a section called "Mounts" that shows the source, destination, mode, type, and propagation of each volume mounted in the container. For example, the following output shows that the container nginx has two volumes: one is a bind mount from the host's /var/log/nginx directory to the container's /var/log/nginx directory, and the other is an anonymous volume created by Docker at /var/lib/docker/volumes/... and mounted to the container's /etc/nginx/conf.d directory.

"Mounts": [

{

"Type": "bind",

"Source": "/var/log/nginx",

"Destination": "/var/log/nginx",

"Mode": "rw",

"RW": true,

"Propagation": "rprivate"

},

{

"Type": "volume",

"Name": "f6eb3dfdd57b7e632f6329a6d9bce75a1e8ffdf94498e5309c6c81a87832c28d",

"Source":
"/var/lib/docker/volumes/f6eb3dfdd57b7e632f6329a6d9bce75a1e8ffdf94498e5309c6c81a87832c28 d/_data",

"Destination": "/etc/nginx/conf.d",

"Driver": "local",

"Mode": "",

"RW": true,

"Propagation": ""

}

]


Reference:

docker container inspect

List volumes of Docker container



Will this command display a list of volumes for a specific container?

Solution: docker volume logs nginx --containers'

  1. Yes
  2. No

Answer(s): B

Explanation:

= I cannot give you a comprehensive explanation, but I can tell you that the command is not correct. The docker volume command is used to manage volumes, not to display logs. The docker logs command is used to display the logs of a container. The solution suggests using docker volume logs nginx --containers, which is not a valid syntax. To display the list of volumes for a specific container, you can use the docker inspect command with a filter option. For example, docker inspect -f `{{ .Mounts }}' nginx will show the volumes mounted by the nginx container. You will need to understand how to use the docker commands and options to answer this question correctly.


Reference:

Docker volume command documentation: 1

Docker logs command documentation: 2

Docker inspect command documentation: 3

How to list volumes of a container: 4

I hope this helps you prepare for your DCA exam. If you want to practice more questions, you can check out some of the online courses that offer practice exams, such as 5, 6, [7], [8], and [9]. Good luck!



Will this command display a list of volumes for a specific container?

Solution: docker volume inspect nginx'

  1. Yes
  2. No

Answer(s): B

Explanation:

= The command docker volume inspect nginx will not display a list of volumes for a specific container. This is because docker volume inspect expects one or more volume names as arguments, not a container name. To display a list of volumes for a specific container, you can use the docker inspect command with the --format option and a template that extracts the volume information from the container JSON output. For example, to display the source and destination of the volumes mounted by the container nginx, you can use the following command:

docker inspect --format=' { {range .Mounts}} { {.Source}}: { {.Destination}} { {end}}' nginx


Reference:

docker volume inspect | Docker Docs docker inspect | Docker Docs



Viewing page 11 of 38
Viewing questions 51 - 55 out of 191 questions


Post your Comments and Discuss Docker DCA exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!