首页 > 代码库 > inspect a service on the swarm
inspect a service on the 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。