Merge pull request #145 from marksteve/run-rm

Add option to remove container in `docker run` (Closes #137)
This commit is contained in:
Ben Firshman 2014-03-05 11:58:44 +00:00
commit fc4b3d2771
1 changed files with 5 additions and 0 deletions

View File

@ -209,6 +209,7 @@ class TopLevelCommand(Command):
container name
-T Disable pseudo-tty allocation. By default `fig run`
allocates a TTY.
--rm Remove container after run. Ignored in detached mode.
"""
service = self.project.get_service(options['SERVICE'])
@ -229,6 +230,10 @@ class TopLevelCommand(Command):
with self._attach_to_container(container.id, raw=tty) as c:
service.start_container(container, ports=None)
c.run()
if options['--rm']:
container.wait()
log.info("Removing %s..." % container.name)
self.client.remove_container(container.id)
def scale(self, options):
"""