DockerSource#

pydantic model nublado.models.images.DockerSource#

Docker Registry from which to get images.

Parameters:

data (Any)

Show JSON schema
{
   "title": "DockerSource",
   "description": "Docker Registry from which to get images.",
   "type": "object",
   "properties": {
      "type": {
         "const": "docker",
         "title": "Type of image source",
         "type": "string"
      },
      "registry": {
         "default": "docker.io",
         "description": "Hostname and optional port of the Docker registry holding lab images",
         "examples": [
            "lighthouse.ceres"
         ],
         "title": "Docker registry",
         "type": "string"
      },
      "repository": {
         "description": "Docker repository path to the lab image, without tags or digests. This is sometimes called the image name.",
         "examples": [
            "library/sketchbook"
         ],
         "title": "Docker repository (image name)",
         "type": "string"
      },
      "credentials_path": {
         "default": "/etc/secrets/.dockerconfigjson",
         "description": "Path to a file containing a JSON-encoded dictionary of Docker credentials for various registries, in the same format as the Docker configuration file and the value of a Kubernetes pull secret",
         "format": "path",
         "title": "Path to Docker API credentials",
         "type": "string"
      }
   },
   "required": [
      "type",
      "repository"
   ]
}

Fields:
field credentials_path: Annotated[Path] = PosixPath('/etc/secrets/.dockerconfigjson')#

Path to a file containing a JSON-encoded dictionary of Docker credentials for various registries, in the same format as the Docker configuration file and the value of a Kubernetes pull secret

field registry: Annotated[str] = 'docker.io'#

Hostname and optional port of the Docker registry holding lab images

field repository: Annotated[str] [Required]#

Docker repository path to the lab image, without tags or digests. This is sometimes called the image name.

field type: Annotated[Literal['docker']] [Required]#
read_credentials()#

Load the credentials store.

Returns:

Object representing the contents of the credentials store.

Return type:

DockerCredentialStore

Raises:

FileNotFoundError – Raised if the file pointed to by credentials_path does not exist.

to_logging_context()#

Build key/value pairs suitable for passing to structlog.

Returns:

Key/value pairs suitable for adding to a structlog context when logging messages about talking to this registry.

Return type:

dict of str

url_for(route)#

Construct a URL to the Docker v2 API for the given route.

Parameters:

route (str) – Route fragment to add to the URL after the repository name. This fragment should omit any leading /.

Returns:

Constructed API URL.

Return type:

str