diff --git a/repo2docker/docker.py b/repo2docker/docker.py index cb3a5dba..d637674a 100644 --- a/repo2docker/docker.py +++ b/repo2docker/docker.py @@ -25,6 +25,9 @@ class DockerContainer(Container): def stop(self, *, timeout=10): return self._c.stop(timeout=timeout) + def wait(self): + return self._c.wait() + @property def exitcode(self): return self._c.attrs["State"]["ExitCode"] @@ -61,7 +64,7 @@ class DockerEngine(ContainerEngine): dockerfile="", fileobj=None, path="", - **kwargs + **kwargs, ): return self._apiclient.build( buildargs=buildargs, @@ -99,7 +102,7 @@ class DockerEngine(ContainerEngine): publish_all_ports=False, remove=False, volumes=None, - **kwargs + **kwargs, ): client = docker.from_env(version="auto") container = client.containers.run( diff --git a/repo2docker/engine.py b/repo2docker/engine.py index 6b9fa117..2db8bfca 100644 --- a/repo2docker/engine.py +++ b/repo2docker/engine.py @@ -62,6 +62,12 @@ class Container(ABC): timeout : If the container doesn't gracefully stop after this timeout kill it """ + @abstractmethod + def wait(self): + """ + Wait for the container to stop + """ + @property @abstractmethod def exitcode(self): @@ -161,7 +167,7 @@ class ContainerEngine(LoggingConfigurable): dockerfile="", fileobj=None, path="", - **kwargs + **kwargs, ): """ Build a container @@ -255,7 +261,7 @@ class ContainerEngine(LoggingConfigurable): publish_all_ports=False, remove=False, volumes={}, - **kwargs + **kwargs, ): """ Run a container