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")
| 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() |