Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

RemoteImage

Pulls a Docker image to a given Docker host from a Docker Registry.

This resource will not pull new layers of the image automatically unless used in conjunction with docker.RegistryImage data source to update the pull_triggers field.

Example Usage

using Pulumi;
using Docker = Pulumi.Docker;

class MyStack : Stack
{
    public MyStack()
    {
        // Find the latest Ubuntu precise image.
        var ubuntu = new Docker.RemoteImage("ubuntu", new Docker.RemoteImageArgs
        {
            Name = "ubuntu:precise",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-docker/sdk/v2/go/docker"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := docker.NewRemoteImage(ctx, "ubuntu", &docker.RemoteImageArgs{
            Name: pulumi.String("ubuntu:precise"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_docker as docker

# Find the latest Ubuntu precise image.
ubuntu = docker.RemoteImage("ubuntu", name="ubuntu:precise")
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

// Find the latest Ubuntu precise image.
const ubuntu = new docker.RemoteImage("ubuntu", {
    name: "ubuntu:precise",
});

Dynamic image

using Pulumi;
using Docker = Pulumi.Docker;

class MyStack : Stack
{
    public MyStack()
    {
        var ubuntuRegistryImage = Output.Create(Docker.GetRegistryImage.InvokeAsync(new Docker.GetRegistryImageArgs
        {
            Name = "ubuntu:precise",
        }));
        var ubuntuRemoteImage = new Docker.RemoteImage("ubuntuRemoteImage", new Docker.RemoteImageArgs
        {
            Name = ubuntuRegistryImage.Apply(ubuntuRegistryImage => ubuntuRegistryImage.Name),
            PullTriggers = 
            {
                ubuntuRegistryImage.Apply(ubuntuRegistryImage => ubuntuRegistryImage.Sha256Digest),
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-docker/sdk/v2/go/docker"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "ubuntu:precise"
        ubuntuRegistryImage, err := docker.LookupRegistryImage(ctx, &docker.LookupRegistryImageArgs{
            Name: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        _, err = docker.NewRemoteImage(ctx, "ubuntuRemoteImage", &docker.RemoteImageArgs{
            Name: pulumi.String(ubuntuRegistryImage.Name),
            PullTriggers: pulumi.StringArray{
                pulumi.String(ubuntuRegistryImage.Sha256Digest),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_docker as docker

ubuntu_registry_image = docker.get_registry_image(name="ubuntu:precise")
ubuntu_remote_image = docker.RemoteImage("ubuntuRemoteImage",
    name=ubuntu_registry_image.name,
    pull_triggers=[ubuntu_registry_image.sha256_digest])
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

const ubuntuRegistryImage = docker.getRegistryImage({
    name: "ubuntu:precise",
});
const ubuntuRemoteImage = new docker.RemoteImage("ubuntuRemoteImage", {
    name: ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.name),
    pullTriggers: [ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.sha256Digest)],
});

Create a RemoteImage Resource

new RemoteImage(name: string, args: RemoteImageArgs, opts?: CustomResourceOptions);
def RemoteImage(resource_name: str, opts: Optional[ResourceOptions] = None, build: Optional[RemoteImageBuildArgs] = None, force_remove: Optional[bool] = None, keep_locally: Optional[bool] = None, name: Optional[str] = None, pull_trigger: Optional[str] = None, pull_triggers: Optional[Sequence[str]] = None)
func NewRemoteImage(ctx *Context, name string, args RemoteImageArgs, opts ...ResourceOption) (*RemoteImage, error)
public RemoteImage(string name, RemoteImageArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args RemoteImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RemoteImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RemoteImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

RemoteImage Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The RemoteImage resource accepts the following input properties:

Name string

The name of the Docker image, including any tags or SHA256 repo digests.

Build RemoteImageBuildArgs

See Build below for details.

ForceRemove bool

Force remove the image when the resource is destroyed

KeepLocally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

PullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

PullTriggers List<string>

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

Name string

The name of the Docker image, including any tags or SHA256 repo digests.

Build RemoteImageBuild

See Build below for details.

ForceRemove bool

Force remove the image when the resource is destroyed

KeepLocally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

PullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

PullTriggers []string

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

name string

The name of the Docker image, including any tags or SHA256 repo digests.

build RemoteImageBuild

See Build below for details.

forceRemove boolean

Force remove the image when the resource is destroyed

keepLocally boolean

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

pullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

pullTriggers string[]

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

name str

The name of the Docker image, including any tags or SHA256 repo digests.

build RemoteImageBuildArgs

See Build below for details.

force_remove bool

Force remove the image when the resource is destroyed

keep_locally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

pull_trigger str

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

pull_triggers Sequence[str]

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

Outputs

All input properties are implicitly available as output properties. Additionally, the RemoteImage resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Latest string
Output string
Id string
The provider-assigned unique ID for this managed resource.
Latest string
Output string
id string
The provider-assigned unique ID for this managed resource.
latest string
output string
id str
The provider-assigned unique ID for this managed resource.
latest str
output str

Look up an Existing RemoteImage Resource

Get an existing RemoteImage resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RemoteImageState, opts?: CustomResourceOptions): RemoteImage
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, build: Optional[RemoteImageBuildArgs] = None, force_remove: Optional[bool] = None, keep_locally: Optional[bool] = None, latest: Optional[str] = None, name: Optional[str] = None, output: Optional[str] = None, pull_trigger: Optional[str] = None, pull_triggers: Optional[Sequence[str]] = None) -> RemoteImage
func GetRemoteImage(ctx *Context, name string, id IDInput, state *RemoteImageState, opts ...ResourceOption) (*RemoteImage, error)
public static RemoteImage Get(string name, Input<string> id, RemoteImageState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Build RemoteImageBuildArgs

See Build below for details.

ForceRemove bool

Force remove the image when the resource is destroyed

KeepLocally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

Latest string
Name string

The name of the Docker image, including any tags or SHA256 repo digests.

Output string
PullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

PullTriggers List<string>

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

Build RemoteImageBuild

See Build below for details.

ForceRemove bool

Force remove the image when the resource is destroyed

KeepLocally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

Latest string
Name string

The name of the Docker image, including any tags or SHA256 repo digests.

Output string
PullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

PullTriggers []string

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

build RemoteImageBuild

See Build below for details.

forceRemove boolean

Force remove the image when the resource is destroyed

keepLocally boolean

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

latest string
name string

The name of the Docker image, including any tags or SHA256 repo digests.

output string
pullTrigger string

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

pullTriggers string[]

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

build RemoteImageBuildArgs

See Build below for details.

force_remove bool

Force remove the image when the resource is destroyed

keep_locally bool

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

latest str
name str

The name of the Docker image, including any tags or SHA256 repo digests.

output str
pull_trigger str

Deprecated, use pull_triggers instead.

Deprecated: Use field pull_triggers instead

pull_triggers Sequence[str]

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker.RegistryImage data source to trigger an image update.

Supporting Types

RemoteImageBuild

Path string
BuildArg Dictionary<string, string>
Dockerfile string

default Dockerfile

ForceRemove bool
Label Dictionary<string, string>
NoCache bool
Remove bool

default true

Tags List<string>
Target string
Path string
BuildArg map[string]string
Dockerfile string

default Dockerfile

ForceRemove bool
Label map[string]string
NoCache bool
Remove bool

default true

Tags []string
Target string
path string
buildArg {[key: string]: string}
dockerfile string

default Dockerfile

forceRemove boolean
label {[key: string]: string}
noCache boolean
remove boolean

default true

tags string[]
target string
path str
build_arg Mapping[str, str]
dockerfile str

default Dockerfile

force_remove bool
label Mapping[str, str]
no_cache bool
remove bool

default true

tags Sequence[str]
target str

Package Details

Repository
https://github.com/pulumi/pulumi-docker
License
Apache-2.0
Notes
This Pulumi package is based on the docker Terraform Provider.