码迷,mamicode.com
首页 > 数据库 > 详细

Docker RestApi Create mysql Container

时间:2015-09-02 10:41:27      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:

docker 提供了创建容器的rest api

http://192.168.150.6:8888/containers/create?name=demo-mysql

docker mysql容器的参数,通过restclient 发送一个post请求给docker

{
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_ROOT_PASSWORD=123456"
],
"Cmd": null,
"Entrypoint": null,
"Image": "mysql:latest",
"Labels": {
"com.l2cloudo.mysql": "jake-mysql"
},
"WorkingDir": null,
"NetworkDisabled": false,
"MacAddress": "12:34:56:78:9a:bc",
"ExposedPorts": {
"3306/tcp": {}
},
"HostConfig": {
"Binds": ["/tmp:/tmp"],
"Memory": 0,
"MemorySwap": 0,
"CpuShares": 512,
"CpuPeriod": 100000,
"CpusetCpus": "",
"CpusetMems": "",
"BlkioWeight": 300,
"OomKillDisable": false,
"PortBindings": { "3306/tcp": [{ "HostPort": "13306" }] },
"PublishAllPorts": false,
"Privileged": false,
"ReadonlyRootfs": false,
"DnsSearch": [""],
"ExtraHosts": null,
"CapAdd": ["NET_ADMIN"],
"CapDrop": ["MKNOD"],
"RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
"NetworkMode": "bridge",
"Devices": [],
"LogConfig": { "Type": "json-file", "Config": {} },
"CgroupParent": ""
}
}

  

创建OK的话,返回响应内容是:

{"Id":"ceb3cd1143432822de2e28f194b8b4ac8d7a72eb4e50b692b9070dbfbd3df2fa","Warnings":null}

  

Docker RestApi Create mysql Container

标签:

原文地址:http://www.cnblogs.com/heidsoft/p/4777757.html

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