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):
|
def stop(self, *, timeout=10):
|
||||||
return self._c.stop(timeout=timeout)
|
return self._c.stop(timeout=timeout)
|
||||||
|
|
||||||
|
def wait(self):
|
||||||
|
return self._c.wait()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def exitcode(self):
|
def exitcode(self):
|
||||||
return self._c.attrs["State"]["ExitCode"]
|
return self._c.attrs["State"]["ExitCode"]
|
||||||
|
@ -61,7 +64,7 @@ class DockerEngine(ContainerEngine):
|
||||||
dockerfile="",
|
dockerfile="",
|
||||||
fileobj=None,
|
fileobj=None,
|
||||||
path="",
|
path="",
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
return self._apiclient.build(
|
return self._apiclient.build(
|
||||||
buildargs=buildargs,
|
buildargs=buildargs,
|
||||||
|
@ -99,7 +102,7 @@ class DockerEngine(ContainerEngine):
|
||||||
publish_all_ports=False,
|
publish_all_ports=False,
|
||||||
remove=False,
|
remove=False,
|
||||||
volumes=None,
|
volumes=None,
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
client = docker.from_env(version="auto")
|
client = docker.from_env(version="auto")
|
||||||
container = client.containers.run(
|
container = client.containers.run(
|
||||||
|
|
|
@ -62,6 +62,12 @@ class Container(ABC):
|
||||||
timeout : If the container doesn't gracefully stop after this timeout kill it
|
timeout : If the container doesn't gracefully stop after this timeout kill it
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def wait(self):
|
||||||
|
"""
|
||||||
|
Wait for the container to stop
|
||||||
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def exitcode(self):
|
def exitcode(self):
|
||||||
|
@ -161,7 +167,7 @@ class ContainerEngine(LoggingConfigurable):
|
||||||
dockerfile="",
|
dockerfile="",
|
||||||
fileobj=None,
|
fileobj=None,
|
||||||
path="",
|
path="",
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Build a container
|
Build a container
|
||||||
|
@ -255,7 +261,7 @@ class ContainerEngine(LoggingConfigurable):
|
||||||
publish_all_ports=False,
|
publish_all_ports=False,
|
||||||
remove=False,
|
remove=False,
|
||||||
volumes={},
|
volumes={},
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Run a container
|
Run a container
|
||||||
|
|
Ładowanie…
Reference in New Issue