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
Remote
Image Build Args 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 string Deprecated, use
pull_triggers
instead.- Pull
Triggers 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
Remote
Image Build 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 string Deprecated, use
pull_triggers
instead.- Pull
Triggers []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
Remote
Image Build See Build below for details.
- force
Remove boolean Force remove the image when the resource is destroyed
- keep
Locally 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.
- pull
Trigger string Deprecated, use
pull_triggers
instead.- pull
Triggers 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
Remote
Image Build Args 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.- 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:
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
Remote
Image Build Args 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 string
- Name string
The name of the Docker image, including any tags or SHA256 repo digests.
- Output string
- Pull
Trigger string Deprecated, use
pull_triggers
instead.- Pull
Triggers 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
Remote
Image Build 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 string
- Name string
The name of the Docker image, including any tags or SHA256 repo digests.
- Output string
- Pull
Trigger string Deprecated, use
pull_triggers
instead.- Pull
Triggers []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
Remote
Image Build See Build below for details.
- force
Remove boolean Force remove the image when the resource is destroyed
- keep
Locally 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
- pull
Trigger string Deprecated, use
pull_triggers
instead.- pull
Triggers 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
Remote
Image Build Args 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.- 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
- Build
Arg Dictionary<string, string> - Dockerfile string
default Dockerfile
- Force
Remove bool - Label Dictionary<string, string>
- No
Cache bool - Remove bool
default true
- List<string>
- Target string
- Path string
- Build
Arg map[string]string - Dockerfile string
default Dockerfile
- Force
Remove bool - Label map[string]string
- No
Cache bool - Remove bool
default true
- []string
- Target string
- path string
- build
Arg {[key: string]: string} - dockerfile string
default Dockerfile
- force
Remove boolean - label {[key: string]: string}
- no
Cache boolean - remove boolean
default true
- 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
- 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.