avoid breaking if AutoRemove is not found

This commit is contained in:
root 2018-03-30 14:59:39 +01:00
parent 23d60b9977
commit 2c35f9c912

View File

@ -3808,7 +3808,14 @@ def rm_(name, force=False, volumes=False, **kwargs):
'remove this container'.format(name)
)
if stop_ and not force:
auto_remove = inspect_container(name)['HostConfig']['AutoRemove']
inspect_results = inspect_container(name)
try:
auto_remove = inspect_results['HostConfig']['AutoRemove']
except KeyError:
log.error(
'Failed to find AutoRemove in inspect results, Docker API may '
'have changed. Full results: %s', inspect_results
)
stop(name, timeout=timeout)
pre = ps_(all=True)