MCPcopy Index your code
hub / github.com/docker/docker-py / inspect_context

Method inspect_context

docker/context/api.py:180–206  ·  view source on GitHub ↗

Remove a context. Similar to the ``docker context inspect`` command. Args: name (str): The name of the context Raises: :py:class:`docker.errors.MissingContextParameter` If a context name is not provided. :py:class:`docker.errors.C

(cls, name="default")

Source from the content-addressed store, hash-verified

178
179 @classmethod
180 def inspect_context(cls, name="default"):
181 """Remove a context. Similar to the ``docker context inspect`` command.
182
183 Args:
184 name (str): The name of the context
185
186 Raises:
187 :py:class:`docker.errors.MissingContextParameter`
188 If a context name is not provided.
189 :py:class:`docker.errors.ContextNotFound`
190 If a context with the name does not exist.
191
192 Example:
193
194 >>> from docker.context import ContextAPI
195 >>> ContextAPI.remove_context(name='test')
196 >>>
197 """
198 if not name:
199 raise errors.MissingContextParameter("name")
200 if name == "default":
201 return cls.DEFAULT_CONTEXT()
202 ctx = Context.load_context(name)
203 if not ctx:
204 raise errors.ContextNotFound(name)
205
206 return ctx()

Callers 3

test_lifecycleMethod · 0.80
test_context_removeMethod · 0.80

Calls 1

load_contextMethod · 0.80

Tested by 3

test_lifecycleMethod · 0.64
test_context_removeMethod · 0.64