[ 
https://issues.apache.org/jira/browse/MESOS-5967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15561293#comment-15561293
 ] 

Guangya Liu commented on MESOS-5967:
------------------------------------

There are two solutions for this:

Solution 1): Added a new function named as {{inspectImage}} and renamed the 
current function {{inspect}} to {{inspectContainer}}. The only issue is that it 
does not match the docker API match as the docker API is using {{inspect}} for 
both container and image.

Solution 2): Use template to handle this:

{code}
template <typename T>
process::Future<T> inspect(
      const std::string& containerName,
      const Option<Duration>& retryInterval = None()) const;
{code}

Please note that I was not using {{virtual}} above as {{template}} do not 
support {{virtual}}, so here I need to remove {{virtual}}.

Then I can define `Container` and `Image` inspect as following: 

{code}
template<>
 Future<Docker::Container> Docker::inspect(
     const string& containerName,
     const Option<Duration>& retryInterval) const
{
...
}

template<>
 Future<Docker::Image> Docker::inspect(
     const string& imageName,
     const Option<Duration>& retryInterval) const
{
...
}
{code}

For the caller part, container will be:

{code}
docker->inspect<Docker::Container>(...);
{code}

and image will be:

{code}
docker->inspect<Docker::Image>(...);
{code}

I think solution 1) is more simple, as solution 2) need remove {{virutal}} for 
{{inspect}}, though it has no impact but  this will make the code not 
consistent, [~bmahler] [~klueska] any comments? Thanks.

> Add support for 'docker image inspect' in our docker abstraction
> ----------------------------------------------------------------
>
>                 Key: MESOS-5967
>                 URL: https://issues.apache.org/jira/browse/MESOS-5967
>             Project: Mesos
>          Issue Type: Improvement
>            Reporter: Kevin Klues
>            Assignee: Guangya Liu
>              Labels: gpu
>             Fix For: 1.1.0
>
>
> Docker's command line tool for {{docker inspect}} can take either a 
> {{container}}, an {{image}}, or a {{task}} as its argument, and return a JSON 
> array containing low-level information about that container, image or task. 
> However, the current {{docker inspect}} support in our docker abstraction 
> only supports inspecting containers (not images or tasks).  We should expand 
> this to (at least) support images.
> In particular, this additional functionality is motivated by the upcoming GPU 
> support, which needs to inspect the labels in a docker image to decide if it 
> should inject the required Nvidia volumes into a container.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to