码迷,mamicode.com
首页 > 其他好文 > 详细

inspect a service on the swarm

时间:2017-06-27 13:49:08      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:docker swarm

当你在一个swarm 中部署了一个服务,你可以通过以下的命令行语句来查看集群中运行的服务的详细信息

docker service inspect --pretty <SERVICE-ID>


$docker machine ssh manager1

查看helloworld 服务的详细信息
$ docker service inspect --pretty helloworld
ID:9uk4639qpg7npwf3fn2aasksr
Name:helloworld
Service Mode:REPLICATED
 Replicas:1
Placement:
UpdateConfig:
 Parallelism:1
ContainerSpec:
 Image:alpine
 Args:ping docker.com
Resources:
Endpoint Mode:  vip


如果需要返回的信息是json格式,只需要不带 --pretty 参数即可

$ docker service inspect helloworld
[
{
    "ID": "9uk4639qpg7npwf3fn2aasksr",
    "Version": {
        "Index": 418
    },
    "CreatedAt": "2016-06-16T21:57:11.622222327Z",
    "UpdatedAt": "2016-06-16T21:57:11.622222327Z",
    "Spec": {
        "Name": "helloworld",
        "TaskTemplate": {
            "ContainerSpec": {
                "Image": "alpine",
                "Args": [
                    "ping",
                    "docker.com"
                ]
            },

     

      "Resources": {
                "Limits": {},
                "Reservations": {}
  },
            "RestartPolicy": {
                "Condition": "any",
                "MaxAttempts": 0
            },
            "Placement": {}
        },
        "Mode": {
            "Replicated": {
                "Replicas": 1
            }
        },
        "UpdateConfig": {
            "Parallelism": 1
        },
        "EndpointSpec": {
            "Mode": "vip"
        }
    },
    "Endpoint": {
        "Spec": {}
    }
}
]


查看哪个节点运行helloworld服务

docker service ps <SERVICE-ID>

$ docker service ps helloworld
NAME                                    IMAGE   NODE     DESIRED STATE  LAST STATE
helloworld.1.8p1vev3fq5zm0mi8g0as41w35  alpine  worker2  Running        Running 3 minutes


本文出自 “清风柳絮” 博客,请务必保留此出处http://binuu.blog.51cto.com/801317/1942337

inspect a service on the swarm

标签:docker swarm

原文地址:http://binuu.blog.51cto.com/801317/1942337

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!