Docker
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
Basic
using Pulumi;
using Docker = Pulumi.Docker;
class MyStack : Stack
{
public MyStack()
{
var ubuntu = new Docker.RemoteImage("ubuntu", new Docker.RemoteImageArgs
{
Name = "ubuntu:precise",
});
}
}
package main
import (
"github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
"github.com/pulumi/pulumi/sdk/v3/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
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.RemoteImage;
import com.pulumi.docker.RemoteImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ubuntu = new RemoteImage("ubuntu", RemoteImageArgs.builder()
.name("ubuntu:precise")
.build());
}
}
import pulumi
import pulumi_docker as docker
ubuntu = docker.RemoteImage("ubuntu", name="ubuntu:precise")
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
const ubuntu = new docker.RemoteImage("ubuntu", {
name: "ubuntu:precise",
});
resources:
ubuntu:
type: docker:RemoteImage
properties:
name: ubuntu:precise
Dynamic updates
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/v3/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ubuntuRegistryImage, err := docker.LookupRegistryImage(ctx, &GetRegistryImageArgs{
Name: "ubuntu:precise",
}, 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
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.DockerFunctions;
import com.pulumi.docker.inputs.GetRegistryImageArgs;
import com.pulumi.docker.RemoteImage;
import com.pulumi.docker.RemoteImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var ubuntuRegistryImage = DockerFunctions.getRegistryImage(GetRegistryImageArgs.builder()
.name("ubuntu:precise")
.build());
var ubuntuRemoteImage = new RemoteImage("ubuntuRemoteImage", RemoteImageArgs.builder()
.name(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.name()))
.pullTriggers(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.sha256Digest()))
.build());
}
}
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)],
});
resources:
ubuntuRemoteImage:
type: docker:RemoteImage
properties:
name: ${ubuntuRegistryImage.name}
pullTriggers:
- ${ubuntuRegistryImage.sha256Digest}
variables:
ubuntuRegistryImage:
Fn::Invoke:
Function: docker:getRegistryImage
Arguments:
name: ubuntu:precise
Build
using Pulumi;
using Docker = Pulumi.Docker;
class MyStack : Stack
{
public MyStack()
{
var zoo = new Docker.RemoteImage("zoo", new Docker.RemoteImageArgs
{
Name = "zoo",
Build = new Docker.Inputs.RemoteImageBuildArgs
{
Path = ".",
Tags =
{
"zoo:develop",
},
BuildArg =
{
{ "foo", "zoo" },
},
Label =
{
{ "author", "zoo" },
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := docker.NewRemoteImage(ctx, "zoo", &docker.RemoteImageArgs{
Name: pulumi.String("zoo"),
Build: &RemoteImageBuildArgs{
Path: pulumi.String("."),
Tags: pulumi.StringArray{
pulumi.String("zoo:develop"),
},
BuildArg: pulumi.StringMap{
"foo": pulumi.String("zoo"),
},
Label: pulumi.StringMap{
"author": pulumi.String("zoo"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.RemoteImage;
import com.pulumi.docker.RemoteImageArgs;
import com.pulumi.docker.inputs.RemoteImageBuildArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var zoo = new RemoteImage("zoo", RemoteImageArgs.builder()
.name("zoo")
.build(RemoteImageBuildArgs.builder()
.path(".")
.tags("zoo:develop")
.buildArg(Map.of("foo", "zoo"))
.label(Map.of("author", "zoo"))
.build())
.build());
}
}
import pulumi
import pulumi_docker as docker
zoo = docker.RemoteImage("zoo",
name="zoo",
build=docker.RemoteImageBuildArgs(
path=".",
tags=["zoo:develop"],
build_arg={
"foo": "zoo",
},
label={
"author": "zoo",
},
))
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
const zoo = new docker.RemoteImage("zoo", {
name: "zoo",
build: {
path: ".",
tags: ["zoo:develop"],
buildArg: {
foo: "zoo",
},
label: {
author: "zoo",
},
},
});
resources:
zoo:
type: docker:RemoteImage
properties:
name: zoo
build:
path: .
tags:
- zoo:develop
buildArg:
foo: zoo
label:
author: zoo
Create a RemoteImage Resource
new RemoteImage(name: string, args: RemoteImageArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def RemoteImage(resource_name: str,
args: RemoteImageArgs,
opts: Optional[ResourceOptions] = None)
func NewRemoteImage(ctx *Context, name string, args RemoteImageArgs, opts ...ResourceOption) (*RemoteImage, error)
public RemoteImage(string name, RemoteImageArgs args, CustomResourceOptions? opts = null)
public RemoteImage(String name, RemoteImageArgs args)
public RemoteImage(String name, RemoteImageArgs args, CustomResourceOptions options)
type: docker:RemoteImage
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args RemoteImageArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args RemoteImageArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts 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 Configuration to build an image. Please see docker build command reference too.
- Force
Remove bool If true, then the image is removed forcibly 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 A value which cause an image pull when changed
Use field 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_registry_image.
- Name string
The name of the Docker image, including any tags or SHA256 repo digests.
- Build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- Force
Remove bool If true, then the image is removed forcibly 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 A value which cause an image pull when changed
Use field 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_registry_image.
- name String
The name of the Docker image, including any tags or SHA256 repo digests.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force
Remove Boolean If true, then the image is removed forcibly 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 A value which cause an image pull when changed
Use field 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_registry_image.
- name string
The name of the Docker image, including any tags or SHA256 repo digests.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force
Remove boolean If true, then the image is removed forcibly 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 A value which cause an image pull when changed
Use field 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_registry_image.
- name str
The name of the Docker image, including any tags or SHA256 repo digests.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force_
remove bool If true, then the image is removed forcibly 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 A value which cause an image pull when changed
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_registry_image.
- name String
The name of the Docker image, including any tags or SHA256 repo digests.
- build Property Map
Configuration to build an image. Please see docker build command reference too.
- force
Remove Boolean If true, then the image is removed forcibly 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 A value which cause an image pull when changed
Use field 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_registry_image.
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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- Output string
Is unused and will be removed.
- Repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- Id string
The provider-assigned unique ID for this managed resource.
- Latest string
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- Output string
Is unused and will be removed.
- Repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- id String
The provider-assigned unique ID for this managed resource.
- latest String
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- output String
Is unused and will be removed.
- repo
Digest String The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- id string
The provider-assigned unique ID for this managed resource.
- latest string
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- output string
Is unused and will be removed.
- repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- id str
The provider-assigned unique ID for this managed resource.
- latest str
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- output str
Is unused and will be removed.
- repo_
digest str The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- id String
The provider-assigned unique ID for this managed resource.
- latest String
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- output String
Is unused and will be removed.
- repo
Digest String The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
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,
repo_digest: Optional[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)
public static RemoteImage get(String name, Output<String> id, RemoteImageState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- Force
Remove bool If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- Name string
The name of the Docker image, including any tags or SHA256 repo digests.
- Output string
Is unused and will be removed.
- Pull
Trigger string A value which cause an image pull when changed
Use field 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_registry_image.
- Repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- Build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- Force
Remove bool If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- Name string
The name of the Docker image, including any tags or SHA256 repo digests.
- Output string
Is unused and will be removed.
- Pull
Trigger string A value which cause an image pull when changed
Use field 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_registry_image.
- Repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force
Remove Boolean If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- name String
The name of the Docker image, including any tags or SHA256 repo digests.
- output String
Is unused and will be removed.
- pull
Trigger String A value which cause an image pull when changed
Use field 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_registry_image.
- repo
Digest String The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force
Remove boolean If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- name string
The name of the Docker image, including any tags or SHA256 repo digests.
- output string
Is unused and will be removed.
- pull
Trigger string A value which cause an image pull when changed
Use field 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_registry_image.
- repo
Digest string The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- build
Remote
Image Build Args Configuration to build an image. Please see docker build command reference too.
- force_
remove bool If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- name str
The name of the Docker image, including any tags or SHA256 repo digests.
- output str
Is unused and will be removed.
- pull_
trigger str A value which cause an image pull when changed
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_registry_image.
- repo_
digest str The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
- build Property Map
Configuration to build an image. Please see docker build command reference too.
- force
Remove Boolean If true, then the image is removed forcibly 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
The ID of the image in the form of
sha256:<hash>
image digest. Do not confuse it with the defaultlatest
tag.Use repo_digest instead
- name String
The name of the Docker image, including any tags or SHA256 repo digests.
- output String
Is unused and will be removed.
- pull
Trigger String A value which cause an image pull when changed
Use field 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_registry_image.
- repo
Digest String The image sha256 digest in the form of
repo[:tag]@sha256:<hash>
.
Supporting Types
RemoteImageBuild
- Path string
- Build
Arg Dictionary<string, string> - Dockerfile string
- Force
Remove bool - Label Dictionary<string, string>
- No
Cache bool - Remove bool
- List<string>
- Target string
- Path string
- Build
Arg map[string]string - Dockerfile string
- Force
Remove bool - Label map[string]string
- No
Cache bool - Remove bool
- []string
- Target string
- path String
- build
Arg Map<String,String> - dockerfile String
- force
Remove Boolean - label Map<String,String>
- no
Cache Boolean - remove Boolean
- List<String>
- target String
- path string
- build
Arg {[key: string]: string} - dockerfile string
- force
Remove boolean - label {[key: string]: string}
- no
Cache boolean - remove boolean
- string[]
- target string
- path str
- build_
arg Mapping[str, str] - dockerfile str
- force_
remove bool - label Mapping[str, str]
- no_
cache bool - remove bool
- Sequence[str]
- target str
- path String
- build
Arg Map<String> - dockerfile String
- force
Remove Boolean - label Map<String>
- no
Cache Boolean - remove Boolean
- List<String>
- target String
Package Details
- Repository
- https://github.com/pulumi/pulumi-docker
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
docker
Terraform Provider.