Docker.Image reference
Source:
src/Docker/Image.ts
Builds, tags, and optionally pushes Docker images through the active Docker context.
This resource uses the Docker CLI and whatever daemon or remote context the
CLI is configured to target. It is separate from Cloudflare.Container;
registry image references are the boundary between Docker-managed images and
cloud container platforms.
Image always builds from a Dockerfile. To pull (and optionally re-tag and
push) an existing registry image, use Docker.RemoteImage.
Image: Building Images
Section titled “Image: Building Images”const image = yield* Docker.Image("app", { name: "my-app", tag: "latest", build: { context: "./app", dockerfile: "Dockerfile", args: { NODE_ENV: "production" }, },});Image: Registry Push
Section titled “Image: Registry Push”const image = yield* Docker.Image("app", { name: "my-app", build: { context: "./app" }, registry: { server: "ghcr.io", username: "octocat", password: Config.Redacted("GITHUB_TOKEN"), },});Image: Docker Context
Section titled “Image: Docker Context”const image = yield* Docker.Image("app", { name: "my-app", context: "remote-build", build: { context: "./app" },});RemoteImage
Section titled “RemoteImage”Source:
src/Docker/RemoteImage.ts
Pulls a remote Docker image through the active Docker context, optionally re-tagging it and pushing it to a registry.
The image is available to other Docker resources by imageRef. Use
alwaysPull: false when you want to reuse an existing tag in the configured
Docker daemon instead of pulling on every deploy. Set targetName/targetTag
to re-tag the pulled image, and registry to push it (mirroring it from a
source registry into your own, for example).
RemoteImage: Pulling Images
Section titled “RemoteImage: Pulling Images”Pull nginx
const nginx = yield* Docker.RemoteImage("nginx", { name: "nginx", tag: "alpine",});Reuse an existing daemon tag
const postgres = yield* Docker.RemoteImage("postgres", { name: "postgres", tag: "18-alpine", alwaysPull: false,});RemoteImage: Re-tagging and Pushing
Section titled “RemoteImage: Re-tagging and Pushing”const mirrored = yield* Docker.RemoteImage("nginx-mirror", { name: "nginx", tag: "alpine", targetName: "acme/nginx", targetTag: "alpine", registry: { server: "ghcr.io", username: "octocat", password: Config.Redacted("GITHUB_TOKEN"), },});RemoteImage: Docker Context
Section titled “RemoteImage: Docker Context”const nginx = yield* Docker.RemoteImage("nginx", { name: "nginx", tag: "alpine", context: "remote-build",});