Docker Community Forums

Share and learn in the Docker community.

[SOLVED] having memory parameter for service in stack creation


(Vishnu Bharathi) #1
POST /api/app/v1/service/

{ 
   "name" : "service-name",
   "image": "namespace/image:tag",
   "memory" : "400'
}

Creates a service with memory 400. But,

POST /api/app/v1/stack/

{
   "name" : "stack-name",
   "services" : [
       { 
         "name" : "service-name",
         "image": "namespace/image:tag",
         "memory" : "400'
      }
  ]
}

is throwing an error

{"error": "Service 'service-name': Value {u'image': u'namespace/image:tag', u'name': u'service-name', u'memory': 400} for field '<obj>' contains additional property 'memory' not defined by 'properties' or 'patternProperties' and additionalProperties  is False. See 'https://docs.docker.com/docker-cloud/feature-reference/stack-yaml-reference/' for more details"}

Should the creation of service ( with memory parameter ) via stack creation be allowed in Docker Cloud API ?


(Vishnu Bharathi) #2

services array in stack creation is exact translation of your stack yaml file. All the parameters that can be used in stack yaml file can be sent in it ( Reference https://docs.docker.com/docker-cloud/feature-reference/stack-yaml-reference/ )

Hence i should be using mem_limit instead of memory.