nerdexam
Docker

DCA · Question #46

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?

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.

Submitted by priya_blr· Apr 18, 2026Container Orchestration

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'

How the community answered

(28 responses)
  • A
    4% (1)
  • C
    93% (26)
  • D
    4% (1)

Why each option

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.

A'docker inspect http'

`docker inspect http` would attempt to inspect a container or image named 'http', not a service and its tasks.

B'docker service inspect http'

`docker service inspect http` provides detailed low-level configuration information about the service itself, but it does not list its tasks or their historical states.

C'docker service ps http'Correct

The command 'docker service ps http' displays the tasks (containers) associated with the 'http' service, including their current state, desired state, the node they ran on, and any error messages or exit codes. This provides a comprehensive historical view of task instances, which is essential for diagnosing why a service might not be healthy.

D'docker ps http'

`docker ps http` lists 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

Source: https://docs.docker.com/engine/reference/commandline/service_ps/

Topics

#Docker Services#Docker Swarm CLI#Service Monitoring#Service Tasks

Community Discussion

No community discussion yet for this question.

Full DCA Practice