Skip to content

Commit d47b744

Browse files
committed
Add Container.wait()
1 parent 5778ed0 commit d47b744

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

repo2docker/docker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def remove(self):
2525
def stop(self, *, timeout=10):
2626
return self._c.stop(timeout=timeout)
2727

28+
def wait(self):
29+
return self._c.wait()
30+
2831
@property
2932
def exitcode(self):
3033
return self._c.attrs["State"]["ExitCode"]
@@ -61,7 +64,7 @@ def build(
6164
dockerfile="",
6265
fileobj=None,
6366
path="",
64-
**kwargs
67+
**kwargs,
6568
):
6669
return self._apiclient.build(
6770
buildargs=buildargs,
@@ -99,7 +102,7 @@ def run(
99102
publish_all_ports=False,
100103
remove=False,
101104
volumes=None,
102-
**kwargs
105+
**kwargs,
103106
):
104107
client = docker.from_env(version="auto")
105108
container = client.containers.run(

repo2docker/engine.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ def stop(self, *, timeout=10):
6262
timeout : If the container doesn't gracefully stop after this timeout kill it
6363
"""
6464

65+
@abstractmethod
66+
def wait(self):
67+
"""
68+
Wait for the container to stop
69+
"""
70+
6571
@property
6672
@abstractmethod
6773
def exitcode(self):
@@ -161,7 +167,7 @@ def build(
161167
dockerfile="",
162168
fileobj=None,
163169
path="",
164-
**kwargs
170+
**kwargs,
165171
):
166172
"""
167173
Build a container
@@ -255,7 +261,7 @@ def run(
255261
publish_all_ports=False,
256262
remove=False,
257263
volumes={},
258-
**kwargs
264+
**kwargs,
259265
):
260266
"""
261267
Run a container

0 commit comments

Comments
 (0)