Merge pull request #4360 from shin-/4359-volume-labels

Fix volume definition in v3 schema
This commit is contained in:
Joffrey F 2017-01-19 17:40:29 -08:00 committed by GitHub
commit 263b9e9317
4 changed files with 18 additions and 5 deletions

View File

@ -330,9 +330,9 @@
"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):