问题
Docker Volume plugins are released with Docker 1.8. I am trying to run a Docker container using Mesos/Marathon and I am able to run Docker container with volumes. What I am not able to do is connecting an external volume plugin.
As per marathon documentation any external parameter for Docker run can be passed as key value pair in the "parameter" tag of Marathon API POST.
The Docker container does come up but is not connecting to my plugin for volume. The JSON file is as below. I am using curl connecting to Marathon. Any help is appreciated.
curl -X POST http://A.B.C.D:8080/v2/apps -d @mygoserver.json -H "Content-type: application/json"
{
"id": "basic1",
"cmd": "/mygoserver",
"cpus": 1,
"mem": 2.0,
"container": {
"type": "DOCKER",
"docker": {
"image": "mygoserver"
},
"parameters": [
{ "key": "volume-driver", "value": "testplugin" }
],
"volumes": [
{
"containerPath": "/data",
"hostPath": "mygoserver",
"mode": "RW"
}
]
}
}
回答1:
As per Marathon doc, the parameters
have to be specified as a child of docker
, so in your case it would be:
"container": {
"type": "DOCKER",
"docker": {
"image": "mygoserver"
"parameters": [
{ "key": "volume-driver", "value": "testplugin" }
],
},
...
来源:https://stackoverflow.com/questions/32189172/docker-volume-plugin-marathon