kopia lustrzana https://github.com/jupyterhub/repo2docker
Use standard-ish image_inspect format
rodzic
4ed6685dc9
commit
0e7e0f003e
|
@ -597,7 +597,7 @@ class Repo2Docker(Application):
|
|||
container_volumes = {}
|
||||
if self.volumes:
|
||||
image = client.inspect_image(self.output_image_spec)
|
||||
image_workdir = image["ContainerConfig"]["WorkingDir"]
|
||||
image_workdir = image.config["WorkingDir"]
|
||||
|
||||
for k, v in self.volumes.items():
|
||||
container_volumes[os.path.abspath(k)] = {
|
||||
|
|
|
@ -86,7 +86,8 @@ class DockerEngine(ContainerEngine):
|
|||
return [Image(tags=image["RepoTags"]) for image in images]
|
||||
|
||||
def inspect_image(self, image):
|
||||
return self._apiclient.inspect_image(image)
|
||||
image = self._apiclient.inspect_image(image)
|
||||
return Image(tags=image["RepoTags"], config=image["ContainerConfig"])
|
||||
|
||||
def push(self, image_spec):
|
||||
return self._apiclient.push(image_spec, stream=True)
|
||||
|
|
|
@ -89,8 +89,9 @@ class Image:
|
|||
Information about a container image
|
||||
"""
|
||||
|
||||
def __init__(self, *, tags):
|
||||
def __init__(self, *, tags, config=None):
|
||||
self._tags = tags or []
|
||||
self._config = config
|
||||
|
||||
@property
|
||||
def tags(self):
|
||||
|
@ -102,8 +103,19 @@ class Image:
|
|||
"""
|
||||
return self._tags
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
"""
|
||||
A dictionary of image configuration information
|
||||
|
||||
If this is `None` the information has not been loaded.
|
||||
If not `None` this must include the following fields:
|
||||
- WorkingDir: The default working directory
|
||||
"""
|
||||
return self._config
|
||||
|
||||
def __repr__(self):
|
||||
return "Image(tags={})".format(self.tags)
|
||||
return "Image(tags={},config={})".format(self.tags, self.config)
|
||||
|
||||
|
||||
class ContainerEngine(LoggingConfigurable):
|
||||
|
@ -211,7 +223,7 @@ class ContainerEngine(LoggingConfigurable):
|
|||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Image object with .config dict.
|
||||
"""
|
||||
raise NotImplementedError("inspect_image not implemented")
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue