kopia lustrzana https://github.com/jupyterhub/repo2docker
Add Container.wait()
rodzic
5778ed0381
commit
d47b74492f
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue