标签:
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