Shipyard远程API
2015-09-15 08:35
337 查看
1、鉴权模块
1.1Login,获取token
POSTHeaders
Content-Type:application/json
Body:
{
"username":"admin",
"password":"shipyard"
}
response
{ "auth_token":"$2a$10$kwlWJbgjkEWnN.JhHJINZOp6grcuio1.USA.io28tTLkKzuCnLl.m", "user_agent":"Mozilla/5.0(WindowsNT6.1;WOW64;rv:38.0)Gecko/20100101Firefox/38.0" } |
2、容器管理
2.1获取容器列表
GETHeaders
User-Agent:Mozilla/5.0(WindowsNT6.1;WOW64;rv:38.0)Gecko/20100101Firefox/38.0
X-Access-Token:admin:$$2a$10$kwlWJbgjkEWnN.JhHJINZOp6grcuio1.USA.io28tTLkKzuCnLl.m
response
[ { "id":"5c12b9ad2961cba3a57947ef5a927dd01545bfe8a73785f7c3b13cb7d0704e38", "name":"/shipyard", "image":{ "name":"shipyard/shipyard:latest", "entrypoint":[ "/controller" ], "hostname":"5c12b9ad2961", "bind_ports":[ { "proto":"tcp", "host_ip":"0.0.0.0", "port":8080, "container_port":8080 } ], "restart_policy":{}, "network_mode":"bridge" }, "engine":{ "id":"compute2", "addr":"http://192.168.31.149:4243", "cpus":4, "memory":4096, "labels":[ "dd" ] }, "state":"running", "ports":[ { "proto":"tcp", "host_ip":"0.0.0.0", "port":8080, "container_port":8080 } ] }, { "id":"4a5f16641c2a5ecca0b05b399bfdaf3c62abf3681289189ee5336feeeb96b4a9", "name":"/gloomy_darwin", "image":{ "name":"mysql_test:latest", "environment":{ "CLOUD_URL":"http://192.168.31.147:8080/starott_cloud_client/cloud/commomconfig/" }, "hostname":"mysqls", "restart_policy":{}, "network_mode":"bridge" }, "engine":{ "id":"compute2", "addr":"http://192.168.31.149:4243", "cpus":4, "memory":4096, "labels":[ "dd" ] }, "state":"stopped" }, |
2.2创建容器
POST/api/containersHeaders
User-Agent:Mozilla/5.0(WindowsNT6.1;WOW64;rv:38.0)Gecko/20100101Firefox/38.0
X-Access-Token:admin:$2a$10$P8jnLva2KnYP0xWOLCmYruD0B11z0JIpH3cOnDHplxFdbBIZv.iOW
Requestbody
{ "name":"ehazlett/go-demo", "container_name":"demo", "cpus":0.1, "memory":32, "type":"service", "hostname":"", "domain":"", "labels":["local"], "args":[], "environment":{ "FOO":"bar" }, "restart_policy":{ "name":"always" }, "bind_ports":[ { "host_ip":"10.1.2.3", "proto":"tcp", "container_port":8080 }, { "proto":"tcp", "port":80, "container_port":8080 } ], "links":{ "redis":"db" } } |
[ { "state ":{[/code] "started_at":"2014-09-12T00:48:23.824260519Z", "pid":5890, "running":true }[code], "ports ":[[/code] { "container_port":8080, "host_ip":"10.1.2.3", "port":49172, "proto":"tcp" } ][code], "engine ":{[/code] "labels":[ "local", "dev" ], "memory":4096, "cpus":4, "addr":"http://172.16.1.50:2375", "id":"local" }[code], "image ":{[/code] "restart_policy":{ "name":"always" }, "labels":[ "local" ], "bind_ports":[ { "proto":"tcp", "port":49153, "container_port":8080 }, { "proto":"tcp", "port":80, "container_port":8080 } ], "links":{ "redis":"db" }, "type":"service", "memory":32, "cpus":0.1, "name":"ehazlett/go-demo" }[code], "id ":"4a5da04b8428e7241a9d9993699513d11b89948399dedfa12"[/code] [code]} ] |
2.3重启容器
GET/api/containers/<id>/restart
Restartacontainer
Request
GET/api/containers/3e532/restartHTTP/1.1
Response
HTTP/1.1204NoContent
2.4停止容器
GET/api/containers/<id>/stop
Stopacontainer
Request
GET/api/containers/3e532/stopHTTP/1.1
Response
HTTP/1.1204NoContent
2.5销毁容器
DELETE/api/containers/<id>
Destroyacontainer
Request
DELETE/api/containers/3e532HTTP/1.1
Response
HTTP/1.1204NoContent
3、计算节点管理
3.1获取计算节点列表
GETHeaders
User-Agent:Mozilla/5.0(WindowsNT6.1;WOW64;rv:38.0)Gecko/20100101Firefox/38.0
X-Access-Token:admin:$2a$10$P8jnLva2KnYP0xWOLCmYruD0B11z0JIpH3cOnDHplxFdbBIZv.iOW
response
[ { "id":"c589bf34-513e-4a15-8164-146511c5e177", "engine":{ "id":"compute2", "addr":"http://192.168.31.149:4243", "cpus":4, "memory":4096, "labels":[ "dd" ] }, "health":{ "status":"up", "response_time":1375306 }, "docker_version":"1.5.0-dev" } ] |
3.2添加计算节点
POST/api/enginesAddanenginetothecluster
Request
POST/api/enginesHTTP/1.1 Content-Typeapplication/json { "id ":"local" , "ssl_cert ":"" , "ssl_key ":"" , "ca_cert ":"" , "engine ":{[/code] "id":"local", "addr":"http://10.1.2.3:2375", "cpus":4.0, "memory":8192, "labels":[ "local", "dev" ] } } |
Response
HTTP/1.1201Created
3.3删除计算节点
DELETE/api/engines/<id>Removeanenginefromthecluster
Request
DELETE/api/engines/99095f5f-7579-4a70-9369-04ad73c21312HTTP/1.1
Response
HTTP/1.1204NoContent
相关文章推荐
- latex在线帮助文档
- 二维码名片的生成与读取
- max-min fairness 最大最小公平算法
- Linux下解决命令未找到的问题
- iptables-rules
- Differences between ArrayList and Vector
- Git 少用 Pull 多用 Fetch 和 Merge(转)
- Android Handler机制
- 激光雷达在首次上电程序自启动时进程死掉
- iOS如何获取iOS app的资源包
- Swift中的集合类数据结构
- Sqlite3—IOS成长之路
- Sqlite3—IOS成长之路
- 9月14日新闻早班车:国务院印发深化国企改革指导意见
- 黑马程序员-------OC----对象存储
- 公開課
- 第八课 混合
- HDU 1010 Tempter of the Bone heuristic 修剪
- hduoj 查找最大元素 题目2025
- Tom's Classes