DCOS:使用具有相同标签的更新映像更新服务

时间:2019-02-25 14:15:04

标签: docker mesos dcos

我已经设置了.json定义的马拉松服务,如下所示:

{
  "env": {
    "SOMEVAR": "somevalue"
  "labels": {
    "HAPROXY_GROUP": "external",
    "HAPROXY_0_VHOST": "someurl"
  },
  "id": "/mycontainer",
  "backoffFactor": 1.15,
  "backoffSeconds": 1,
  "container": {
    "portMappings": [
      {
        "containerPort": 1111,
        "hostPort": 1111,
        "labels": {
          "VIP_0": "/myservice:5601"
        },
        "protocol": "tcp",
        "servicePort": 10004,
        "name": "myservice"
      }
    ],
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "my-docker-registry/repository/imagename:dev",
      "forcePullImage": true,
      "privileged": false,
      "parameters": []
    }
  },
  "cpus": 1,
  "disk": 0,
  "instances": 1,
  "maxLaunchDelaySeconds": 3600,
  "mem": 1300,
  "gpus": 0,
  "networks": [
    {
      "mode": "container/bridge"
    }
  ],
  "requirePorts": false,
  "upgradeStrategy": {
    "maximumOverCapacity": 1,
    "minimumHealthCapacity": 1
  },
  "killSelection": "YOUNGEST_FIRST",
  "unreachableStrategy": {
    "inactiveAfterSeconds": 0,
    "expungeAfterSeconds": 0
  },
  "healthChecks": [],
  "fetch": [],
  "constraints": []
}

假设我的CI / CD管道创建了一个 NEWER my-docker-registry/repository/imagename:dev映像,我如何强制更新服务以提取最新映像(我想保留tag常量以避免淹没我的注册表)

1 个答案:

答案 0 :(得分:0)

您已经启用了forcePullImage,只需重新启动该服务就足以提取新版本。