Skip to content

Custom Images ​

Pulumi Cloud runs your Pulumi program inside a container image called the deployment executor image. This page covers what is in that image and how to customize it.

The default executor image ​

By default, every deployment runs in pulumi/pulumi, a Debian-based Linux image that includes:

  • The pulumi CLI on $PATH
  • LTS versions of all supported language runtimes: Node.js, Python, Go, .NET, and Java
  • Common build tools: git, curl, and the package manager for each runtime

For most projects this is the right choice. The image is updated with every Pulumi CLI release, security-patched on a regular cadence, and pre-cached on Pulumi-hosted workflow runners, so deployments start quickly without paying a registry pull.

The image is published in pulumi/pulumi-docker-containers. That repository also publishes smaller variants you can use as a base for a custom image. See Choosing a base image below. For the full image catalog — variants, release cadence, and language-version pinning — see Pulumi Docker images.

When to customize ​

You need a different setup when your deployment depends on something not in the default image. Common cases:

  • A CLI such as gh or aws that your Pulumi program or a deployment hook invokes
  • A language runtime version different from the LTS in the default image
  • A system package required by a native dependency
  • A private credential helper

There are two ways to handle this. Pick based on how often you need the tool and how much you care about deployment speed.

Choosing the right approach ​

ApproachBest forCost
Pre-run commandsOne-off tools, scripts, or quick experimentsThe install runs on every deployment, adding setup time to each run
Custom executor imageStable tool sets used on every deploymentSlower cold starts on fresh runners, and an image you have to maintain

Pre-run commands ​

If you need a tool occasionally, or you are still prototyping, install it from a pre-run command in your deployment settings:

bash
apt-get update && apt-get install -y my-tool

Pros:

  • No image to build or maintain
  • Easy to change: edit the command and the next deployment picks it up
  • Works with the default pulumi/pulumi image, so cold starts stay fast

Cons:

  • The install runs on every deployment, adding wall-clock time
  • Network failures during the install fail the deployment
  • Not suitable for very large installs

Reach for a custom image only when the install cost starts to hurt.

Custom executor image ​

A custom executor image is a container image you build, host, and reference from your stack's deployment settings. Pulumi pulls it before running each deployment.

Choosing a base image ​

Pick the smallest base that has the language runtime(s) you need. Pull time scales with image size, so a smaller base means faster first deployments on fresh runners.

Base imageSize (approx.)ContentsBest for
pulumi/pulumi-base~200 MBpulumi CLI onlyYou will install your own language runtime, or use a single language version not in the SDK images
pulumi/pulumi-nodejs, pulumi-python, pulumi-go, pulumi-dotnet, pulumi-java200–400 MBpulumi plus one language runtimeSingle-language projects
pulumi/pulumi~2 GBpulumi plus all language runtimesPolyglot projects, or when you do not want to pick a runtime

If you do not need every language runtime, start from pulumi/pulumi-base or a language-specific variant. The full pulumi/pulumi image is convenient but copies ~2 GB of layers your project will not use.

All variants are listed in the pulumi/pulumi-docker-containers README.

Example: adding the GitHub CLI ​

dockerfile
# Pin the Pulumi CLI version explicitly. Floating tags like :latest mean the
# image and your local CLI can drift apart between deployments.
FROM pulumi/pulumi-base:3.236.0

RUN apt-get update \
    && apt-get install -y --no-install-recommends gh \
    && rm -rf /var/lib/apt/lists/*

Build, push to a registry your deployment runner can reach, then point your stack at it from the Custom Executor Image setting or the executorContext.executorImage field of the REST API.

Image requirements ​

A custom executor image must:

  • Be a Linux image
  • Include curl on $PATH
  • Include the pulumi CLI on $PATH
  • Include the language runtime(s) for the projects that will use it
  • Use a glibc-based libc. Most Pulumi resource provider plugins are glibc-linked, so musl-only images such as Alpine are not supported

If you start from one of the pulumi/* base images, all of these are already true.

Trade-offs ​

Cold starts ​

The default image is pre-cached on Pulumi-hosted workflow runners. Custom images are not. Pulumi-managed runners are single-use, so every deployment runs on a newly provisioned runner that pulls your image from its registry, which can add minutes to the "Preparing environment" phase. No image layers carry over from one deployment to the next on Pulumi-managed runners.

To reduce cold-start time on Pulumi-managed runners:

  • Start from a small base (pulumi-base or a single-language variant), because pull time scales with image size.
  • Host the image in a registry that supports static credentials or needs none, such as a public image on Amazon ECR Public, and prefer one with good network performance.
  • Pin the image to a digest or a specific version tag rather than a floating tag such as latest. Pinning doesn't speed up the pull, but it keeps the image your deployments run from changing unexpectedly.
  • Move rarely changing tools into the image and keep the remaining setup short, so you pay the pull cost once per deployment rather than also running long pre-run installs.

On customer-managed runners, image layers can persist between deployments. Set pull_image: false on a Docker-based agent so it reuses a locally cached image instead of pulling it for every job. On the Kubernetes deploy target, set imagePullPolicy: IfNotPresent on the pulumi-workflow container in the worker Pod template. See Executor image pull policy. Pin a digest or version tag so the cached image is the one you expect.

Static credentials only ​

If your image lives in a private registry, you must supply static username and password credentials in the deployment settings. OIDC and IAM-role-based pulls are not supported for custom executor images.

This rules out a private Amazon ECR registry, which has no long-lived credentials: its registry password is an authorization token from aws ecr get-login-password that expires after 12 hours, so a pasted token soon stops working and deployments can no longer pull the image. (A public image on Amazon ECR Public needs no credentials and works fine.)

If your security model requires short-lived registry credentials — or you need to pull a private image from ECR — Customer-managed runners run in your own infrastructure and can use whatever pull mechanism you configure, including an IAM role.

See also ​

Content from the official Pulumi documentation (github.com/pulumi/docs).