"forcePullImage" 参数设置为 'false'

"forcePullImage" param gets set to 'false'

我正在尝试使用 Marathon 构建 docker 图像,但是当我使用此配置时,"forcePullImage" 参数设置为 '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"
  }
}

构建后,我必须手动将 'false' 参数更改为 'true' 之后它才真正起作用,但是为什么在将它添加到马拉松时它会被设置为 false 以及如何才能我解决了这个问题?

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

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