我试图通过mesos Marathon部署ngnix docker容器,我想在容器中设置一些环境变量,所以我在Json文件中添加了参数部分,但是在我添加参数部分后,它失败了。我的Json文件如下:
{
"container":{
"type":"DOCKER",
"docker":{
"image":"nginx",
"network":"BRIDGE",
"portMappings":[{"containerPort":80,"hostPort":0,"servicePort":80,"protocol":"tcp"}],
"parameters": [
{ "key": "myhostname", "value": "a.corp.org" }
]
}
},
"id":"nginx7",
"instances":1,
"cpus":0.25,
"mem":256,
"uris":[]
}
我的启动脚本是:curl -X POST -H "Content-Type: application/json" 10.3.11.11:8080/v2/apps -d@"$@"
我跑的命令是:./launch.sh nginx.json
答案 0 :(得分:1)
您使用了错误的参数键myhostname
,如果您想为容器设置hostname
,则应该是:
"parameters": [
{ "key": "hostname", "value": "a.corp.org" }
]
如果你想传递环境变量,它应该是:
"parameters": [
{ "key": "env", "value": "myhostname=a.corp.org" }
]