DCA practice question 23 of 25
You created a new service named 'http' and discover it is not registering as healthy. Will this command enable you to view the list of historical tasks for this service? Solution: 'docker ps http'
Full set: 191 questionsThe command docker ps http is incorrect for viewing the tasks of a Swarm service. The docker ps command lists running containers on the specific Docker host where the command is executed. It can filter this list, but it does not query the Swarm manager for service-related information, nor does it show historical (e.g., stopped or failed) containers by default. The correct command to view the current and historical tasks for a service named 'http' is docker service ps http. This command specifically queries the Swarm manager for the state of all tasks associated with that service across the entire cluster.
A. This is incorrect. docker ps operates on the local Docker daemon's containers, not on Swarm service tasks, and will not show historical tasks.
1. Docker Documentation, "docker service ps" CLI reference. The description states: "This command displays the tasks of a service. It provides information about the state of the tasks, and if they are running, on which node." (docs.docker.com/engine/reference/commandline/serviceps/)
2. Docker Documentation, "docker ps" CLI reference. The description states: "List containers." This command's scope is limited to the containers on a single node, not the abstract tasks of a Swarm service. (docs.docker.com/engine/reference/commandline/ps/)
Keep practicing
Take the free DCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DCA practice questions
- Question 1Does this command create a swarm service that only listens on port 53 using the UDP proto…
- Question 2Will this command ensure that overlay traffic between service tasks is encrypted? Solutio…
- Question 4Does this describe the role of Control Groups (cgroups) when used with a Docker container…
- Question 5Can this set of commands identify the published port(s) for a container? Solution: docker…
- Question 6Will this command mount the host's '/data' directory to the ubuntu container in read-only…
- Question 7A company's security policy specifies that development and production containers must run…
