Curl 未与docker远程API绑定的卷

Curl 未与docker远程API绑定的卷,curl,docker,Curl,Docker,我正在尝试使用docker远程API绑定卷。我正在按照指示操作,但它仍然不起作用 我的测试运行这两个curl命令 curl -X POST -H "Content-Type: application/json" http://localhost:4243/containers/create -d '{ "Image" : "ubuntu", "Cmd" : [ "ls", "-la"], "Volumes": { "/mnt": {} }, "WorkingDir

我正在尝试使用docker远程API绑定卷。我正在按照指示操作,但它仍然不起作用

我的测试运行这两个curl命令

    curl -X POST -H "Content-Type: application/json" http://localhost:4243/containers/create    
-d '{
  "Image" : "ubuntu",
  "Cmd" : [ "ls", "-la"],
  "Volumes": { "/mnt": {} },
  "WorkingDir" : "/mnt",
  "NetworkDisabled" : false
}'

curl -XPOST http://localhost:4243/containers/<whateverID>/start -d '{
    "Binds": [ "/tmp/:/mnt:ro" ]
}'
curl-xpost-H“内容类型:application/json”http://localhost:4243/containers/create    
-d'{
“图像”:“ubuntu”,
“Cmd”:[“ls”,“-la”],
“卷”:{“/mnt”:{},
“工作目录”:“/mnt”,
“网络已禁用”:false
}'
curl-XPOSThttp://localhost:4243/containers//start -d'{
“绑定”:[“/tmp/:/mnt:ro”]
}'

api的文档非常糟糕。如果有人能给我指出客户机代码中的相关行,那将是一种工作的基础。还有其他人能做到这一点吗?或者这是一个已知的问题吗?

您忘记在启动请求中将内容类型设置为application/json


一旦您这样做了,它应该会工作。

您是否可以尝试将create和start命令中的
/mnt
修改为默认情况下不存在的装入点/文件夹(例如
/textbind
)?