mirror of https://github.com/docker/compose.git
Fix restart with stopped containers. Fixes #1814
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
This commit is contained in:
parent
09f6a876cf
commit
3a395892fc
|
@ -185,7 +185,7 @@ class Service(object):
|
||||||
c.kill(**options)
|
c.kill(**options)
|
||||||
|
|
||||||
def restart(self, **options):
|
def restart(self, **options):
|
||||||
for c in self.containers():
|
for c in self.containers(stopped=True):
|
||||||
log.info("Restarting %s" % c.name)
|
log.info("Restarting %s" % c.name)
|
||||||
c.restart(**options)
|
c.restart(**options)
|
||||||
|
|
||||||
|
|
|
@ -597,6 +597,15 @@ class CLITestCase(DockerClientTestCase):
|
||||||
started_at,
|
started_at,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_restart_stopped_container(self):
|
||||||
|
service = self.project.get_service('simple')
|
||||||
|
container = service.create_container()
|
||||||
|
container.start()
|
||||||
|
container.kill()
|
||||||
|
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||||
|
self.dispatch(['restart', '-t', '1'], None)
|
||||||
|
self.assertEqual(len(service.containers(stopped=False)), 1)
|
||||||
|
|
||||||
def test_scale(self):
|
def test_scale(self):
|
||||||
project = self.project
|
project = self.project
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue