Skip to content

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).

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,
});
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"),
},
});