" forcePullImage" param设置为“假”'

时间:2016-10-11 10:51:52

标签: json marathon

我正在尝试用Marathon构建一个docker镜像,但是当我使用这个配置时," forcePullImage" param设置为' false'

{
  "id": "name",
  "mem": 1024,
  "cpus": 0.5,
  "instances": 1,
  "container": {
    "type": "DOCKER",
        "volumes": [
      {
        "containerPath": "/etc/localtime",
        "hostPath": "/etc/localtime",
        "mode": "RO"
      }
    ],
    "docker": {
      "image": "dockerimage",
      "network": "BRIDGE",
      "portMappings": [ {
        "containerPort": 8080,
        "hostPort": 0,
        "servicePort": [PORTNUMBER],
        "protocol": "tcp",
        "name": "name"
      }],
      "parameters": [{ "key": "name", "value": "name" }]
    },
    "forcePullImage": true
  },
  "healthChecks": [
  {
    "path": "~/check/",
    "portIndex": 0,
    "protocol": "HTTP",
    "gracePeriodSeconds": 10,
    "intervalSeconds": 2,
    "timeoutSeconds": 10,
    "maxConsecutiveFailures": 10
  }],
  "labels":{
    "HAPROXY_GROUP":"external"
  }
}

当它最终在马拉松环境中构建时,配置文件将设置为:

{
  "id": "name",
  "mem": 1024,
  "cpus": 0.5,
  "instances": 1,
  "container": {
    "type": "DOCKER",
        "volumes": [
      {
        "containerPath": "/etc/localtime",
        "hostPath": "/etc/localtime",
        "mode": "RO"
      }
    ],
    "docker": {
      "image": "dockerimage",
      "network": "BRIDGE",
      "portMappings": [ {
        "containerPort": 8080,
        "hostPort": 0,
        "servicePort": [PORTNUMBER],
        "protocol": "tcp",
        "name": "name"
      }],
      "parameters": [{ "key": "name", "value": "name" }]
    },
    "forcePullImage": false
  },
  "healthChecks": [
  {
    "path": "~/check/",
    "portIndex": 0,
    "protocol": "HTTP",
    "gracePeriodSeconds": 10,
    "intervalSeconds": 2,
    "timeoutSeconds": 10,
    "maxConsecutiveFailures": 10
  }],
  "labels":{
    "HAPROXY_GROUP":"external"
  }
}

构建完成后,我必须手动更改错误' param to' true'之后它实际上有效,但为什么在将它添加到马拉松时它被设置为false,我该如何解决这个问题呢?

1 个答案:

答案 0 :(得分:2)

您发布的Marathon应用程序规范实际上是无效的。如果您查看架构,则会看到forcePullImage has to be a child of docker字段(而不是示例中的container字段)。正确的用法是:

"docker": {
  "image": "dockerimage",
  "forcePullImage": false,
  ...
}