Stop and start container rather than use restart directly
Docker has an issue[0] when restart container. But stop then start works. [0] https://github.com/moby/moby/issues/29704 Change-Id: If0a9c0c257cd72209be8e138a1f0b8871500e089 Closes-Bug: #1707097
This commit is contained in:
parent
71133abce7
commit
7f2ade5b5a
@ -669,7 +669,8 @@ class DockerWorker(object):
|
||||
msg="No such container: {}".format(name))
|
||||
else:
|
||||
self.changed = True
|
||||
self.dc.restart(name, timeout=graceful_timeout)
|
||||
self.dc.stop(name, timeout=graceful_timeout)
|
||||
self.dc.start(name)
|
||||
|
||||
def create_volume(self):
|
||||
if not self.check_volume():
|
||||
|
@ -298,7 +298,8 @@ class TestContainer(base.BaseTestCase):
|
||||
self.assertTrue(self.dw.changed)
|
||||
self.dw.dc.containers.assert_called_once_with(all=True)
|
||||
self.dw.dc.inspect_container.assert_called_once_with('my_container')
|
||||
self.dw.dc.restart.assert_called_once_with('my_container', timeout=10)
|
||||
self.dw.dc.stop.assert_called_once_with('my_container', timeout=10)
|
||||
self.dw.dc.start.assert_called_once_with('my_container')
|
||||
|
||||
def test_restart_container_not_exists(self):
|
||||
self.dw = get_DockerWorker({'name': 'fake-container',
|
||||
|
Loading…
Reference in New Issue
Block a user