Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this possible to get all running containers id's in docker swarm services?

I am newbie in docker swarm mode, If I want more details about my swarm service , from command line I can run docker service ps "service name ", or from docker rest "/v2/services/my-ngx"

[msreddy@swarmnode1 ~]$ docker service ps my-ngx ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS voj7fllhnmqb my-ngx.1 nginx:latest swarmnode1 Running Running 26 minutes ago

but it didn't give me container id. I want track containers form my swarm service is this possible ?

like image 521
thisisms Avatar asked Dec 07 '22 19:12

thisisms


1 Answers

Id returned by docker service ps my-ngx is the <task_id> To get the container id, you can use docker inspect -f "{{.Status.ContainerStatus.ContainerID}}" <task_id>

like image 171
prranay Avatar answered Dec 31 '22 12:12

prranay