通过Remote API传递命令行参数

我正在使用远程API来创build和启动容器,但我不知道如何通过我通常从本地机器创build时通过的命令行参数。 具体来说,我使用这个图像 ,这需要我运行'docker run [arguments] [image]'时通常会做的一堆参数。 有任何想法吗?

对于parameter passing,你可以这样做

curl -X POST localhost:2375/containers/create -H "Content-Type: application/json" -d '{"Cmd":["ping", "8.8.8.8"], "Image": "ubuntu"}' 

另见: http : //blog.flux7.com/blogs/docker/docker-tutorial-series-part-8-docker-remote-api

这取决于你想要设置哪些参数。 直到端口绑定, 在这里你可以find如何做到这一点。 一般来说,您必须使用在创build和启动请求中作为正文传递的JSON对象。