19

We are running docker in swarm mode on a few nodes.

Could not find a quick and easy way to list all containers (preferably with status) in the swarm from the manager nodes. One can see overlay networks and locally-running containers attached to these networks, also services - but not the container details, etc.

Is it something already available or is using the REST API the only available option? (not sure if all required info is available there though)

saabeilin
  • 409
  • 1
  • 4
  • 11

1 Answers1

31

You can do docker node ls to see all the nodes in your swarm, then docker node ps <node> to see the containers on that node.

As a one liner, you can do:

docker node ps $(docker node ls -q)

agxs
  • 433
  • 4
  • 5
  • Seems to be the best solution so far. Need to figure out how to filter and format the results for `node ps` though. – saabeilin Jul 12 '17 at 22:18
  • 4
    This is actualy listing the running services, not all container. – Matthias B Oct 26 '17 at 10:45
  • 7
    I find this command very helpful: `docker node ps $(docker node ls -q) --filter desired-state=Running | uniq` - this will do filtering (desired state) and also removes maybe unwanted information (uniq). – colidyre May 20 '18 at 21:45