Add Container.wait()
MODIFY
repo2docker/docker.py
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(

MODIFY
repo2docker/engine.py
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

Add Container.wait()