Fix volume definition in v3 schema

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-01-19 15:41:31 -08:00
parent 5b912082e1
commit e035931f2e
4 changed files with 20 additions and 6 deletions

View File

@ -328,10 +328,11 @@
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
}
}
},
"additionalProperties": false
},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"labels": {"$ref": "#/definitions/list_or_dict"},
"additionalProperties": false
},

View File

@ -295,7 +295,13 @@ class CLITestCase(DockerClientTestCase):
assert yaml.load(result.stdout) == {
'version': '3.0',
'networks': {},
'volumes': {},
'volumes': {
'foobar': {
'labels': {
'com.docker.compose.test': 'true',
},
},
},
'services': {
'web': {
'image': 'busybox',

View File

@ -35,3 +35,7 @@ services:
retries: 5
stop_grace_period: 20s
volumes:
foobar:
labels:
com.docker.compose.test: 'true'

View File

@ -13,6 +13,7 @@ from compose.config.config import resolve_environment
from compose.config.config import V1
from compose.config.config import V2_0
from compose.config.config import V2_1
from compose.config.config import V3_0
from compose.config.environment import Environment
from compose.const import API_VERSIONS
from compose.const import LABEL_PROJECT
@ -36,13 +37,15 @@ def get_links(container):
def engine_max_version():
if 'DOCKER_VERSION' not in os.environ:
return V2_1
return V3_0
version = os.environ['DOCKER_VERSION'].partition('-')[0]
if version_lt(version, '1.10'):
return V1
elif version_lt(version, '1.12'):
return V2_0
return V2_1
elif version_lt(version, '1.13'):
return V2_1
return V3_0
def build_version_required_decorator(ignored_versions):