Merge pull request #5939 from docker/5928-compatibility-attachable

Ignore attachable property on networks in compatibility mode
This commit is contained in:
Joffrey F 2018-05-04 16:44:00 -07:00 committed by GitHub
commit 263e939125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View File

@ -918,6 +918,11 @@ def convert_restart_policy(name):
def translate_deploy_keys_to_container_config(service_dict):
if 'credential_spec' in service_dict:
del service_dict['credential_spec']
if 'configs' in service_dict:
del service_dict['configs']
if 'deploy' not in service_dict:
return service_dict, []
@ -946,10 +951,6 @@ def translate_deploy_keys_to_container_config(service_dict):
)
del service_dict['deploy']
if 'credential_spec' in service_dict:
del service_dict['credential_spec']
if 'configs' in service_dict:
del service_dict['configs']
return service_dict, ignored_keys

View File

@ -80,6 +80,10 @@ def denormalize_config(config, image_digests=None):
elif 'external' in conf:
conf['external'] = True
if 'attachable' in conf and config.version < V3_2:
# For compatibility mode, this option is invalid in v2
del conf['attachable']
return result

View File

@ -481,6 +481,7 @@ class CLITestCase(DockerClientTestCase):
assert yaml.load(result.stdout) == {
'version': '2.3',
'volumes': {'foo': {'driver': 'default'}},
'networks': {'bar': {}},
'services': {
'foo': {
'command': '/bin/true',
@ -490,9 +491,10 @@ class CLITestCase(DockerClientTestCase):
'mem_limit': '300M',
'mem_reservation': '100M',
'cpus': 0.7,
'volumes': ['foo:/bar:rw']
'volumes': ['foo:/bar:rw'],
'networks': {'bar': None},
}
}
},
}
def test_ps(self):

View File

@ -16,7 +16,13 @@ services:
memory: 100M
volumes:
- foo:/bar
networks:
- bar
volumes:
foo:
driver: default
networks:
bar:
attachable: true