DCA · Question #46
DCA Question #46: Real Exam Question with Answer & Explanation
The correct answer is C: 'docker service ps http'. To view the historical and current tasks associated with a Docker Swarm service, including their status and any past failures, the docker service ps command is used.
Question
After creating a new service named 'http', you notice that the new service is not registering as healthy. How do you view the list of historical tasks for that service by using the command line?
Options
- A'docker inspect http'
- B'docker service inspect http'
- C'docker service ps http'
- D'docker ps http'
Explanation
To view the historical and current tasks associated with a Docker Swarm service, including their status and any past failures, the docker service ps command is used.
Common mistakes.
- A.
docker inspect httpwould attempt to inspect a container or image named 'http', not a service and its tasks. - B.
docker service inspect httpprovides detailed low-level configuration information about the service itself, but it does not list its tasks or their historical states. - D.
docker ps httplists running containers on the local daemon that match 'http', but does not show tasks belonging to a swarm service or historical tasks.
Concept tested. Docker Swarm service task inspection
Reference. https://docs.docker.com/engine/reference/commandline/service_ps/
Topics
Community Discussion
No community discussion yet for this question.