mirror of
https://github.com/docker/compose.git
synced 2025-07-21 12:44:54 +02:00
Merge pull request #5939 from docker/5928-compatibility-attachable
Ignore attachable property on networks in compatibility mode
This commit is contained in:
commit
263e939125
@ -918,6 +918,11 @@ def convert_restart_policy(name):
|
|||||||
|
|
||||||
|
|
||||||
def translate_deploy_keys_to_container_config(service_dict):
|
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:
|
if 'deploy' not in service_dict:
|
||||||
return service_dict, []
|
return service_dict, []
|
||||||
|
|
||||||
@ -946,10 +951,6 @@ def translate_deploy_keys_to_container_config(service_dict):
|
|||||||
)
|
)
|
||||||
|
|
||||||
del service_dict['deploy']
|
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
|
return service_dict, ignored_keys
|
||||||
|
|
||||||
|
@ -80,6 +80,10 @@ def denormalize_config(config, image_digests=None):
|
|||||||
elif 'external' in conf:
|
elif 'external' in conf:
|
||||||
conf['external'] = True
|
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
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,6 +481,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
assert yaml.load(result.stdout) == {
|
assert yaml.load(result.stdout) == {
|
||||||
'version': '2.3',
|
'version': '2.3',
|
||||||
'volumes': {'foo': {'driver': 'default'}},
|
'volumes': {'foo': {'driver': 'default'}},
|
||||||
|
'networks': {'bar': {}},
|
||||||
'services': {
|
'services': {
|
||||||
'foo': {
|
'foo': {
|
||||||
'command': '/bin/true',
|
'command': '/bin/true',
|
||||||
@ -490,9 +491,10 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
'mem_limit': '300M',
|
'mem_limit': '300M',
|
||||||
'mem_reservation': '100M',
|
'mem_reservation': '100M',
|
||||||
'cpus': 0.7,
|
'cpus': 0.7,
|
||||||
'volumes': ['foo:/bar:rw']
|
'volumes': ['foo:/bar:rw'],
|
||||||
|
'networks': {'bar': None},
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_ps(self):
|
def test_ps(self):
|
||||||
|
@ -16,7 +16,13 @@ services:
|
|||||||
memory: 100M
|
memory: 100M
|
||||||
volumes:
|
volumes:
|
||||||
- foo:/bar
|
- foo:/bar
|
||||||
|
networks:
|
||||||
|
- bar
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
foo:
|
foo:
|
||||||
driver: default
|
driver: default
|
||||||
|
|
||||||
|
networks:
|
||||||
|
bar:
|
||||||
|
attachable: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user