跳转到主要内容

Get image pull URLs

Obtain the registry references needed to pull a managed image with an OCI-compatible tool. This is useful when another part of your workflow needs the image content outside a sandbox.

You need an authenticated client and the image name returned by image registration.

Get the pull information {#1-get-the-pull-information}

Read the image's pull specification. The result identifies its manifest digest and image references.

Pass those references to your OCI client. This example only retrieves the pull information; it does not download layers or authenticate a separate registry client. Treat any returned access information as sensitive, and do not publish it in logs.

{{< tabs >}} {{< tab name="TypeScript" >}}

const image = await client.images.get(name);
return image.getPullSpec();
Complete TypeScript example: pullspec/spec.ts
import type { Sandboxes } from '@docker/sandboxes';

export async function getImagePullSpec(client: Sandboxes, name: string) {
  const image = await client.images.get(name);
  return image.getPullSpec();
}

{{< /tab >}} {{< /tabs >}}