RegistryImage class
<!-- Bug: Type and Name are switched -->
Manages the lifecycle of docker image in a registry. You can upload images to a registry (= docker push) and also delete them again
Example Usage
Build an image with the docker.RemoteImage resource and then push it to a registry:
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
const image = new docker.RemoteImage("image", {
name: "registry.com/somename:1.0",
build: {
context: `${process.cwd()}/absolutePathToContextFolder`,
},
});
const helloworld = new docker.RegistryImage("helloworld", {
name: image.name,
keepRemotely: true,
});
import pulumi
import os
import pulumi_docker as docker
image = docker.RemoteImage("image",
name="registry.com/somename:1.0",
build={
"context": f"{os.getcwd()}/absolutePathToContextFolder",
})
helloworld = docker.RegistryImage("helloworld",
name=image.name,
keep_remotely=True)
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Docker = Pulumi.Docker;
return await Deployment.RunAsync(() =>
{
var image = new Docker.RemoteImage("image", new()
{
Name = "registry.com/somename:1.0",
Build = new Docker.Inputs.RemoteImageBuildArgs
{
Context = $"{Directory.GetCurrentDirectory()}/absolutePathToContextFolder",
},
});
var helloworld = new Docker.RegistryImage("helloworld", new()
{
Name = image.Name,
KeepRemotely = true,
});
});
package main
import (
"os"
"github.com/pulumi/pulumi-docker/sdk/v5/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
image, err := docker.NewRemoteImage(ctx, "image", &docker.RemoteImageArgs{
Name: pulumi.String("registry.com/somename:1.0"),
Build: &docker.RemoteImageBuildArgs{
Context: pulumi.Sprintf("%v/absolutePathToContextFolder", func(cwd string, err error) string {
if err != nil {
panic(err)
}
return cwd
}(os.Getwd())),
},
})
if err != nil {
return err
}
_, err = docker.NewRegistryImage(ctx, "helloworld", &docker.RegistryImageArgs{
Name: image.Name,
KeepRemotely: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
docker = {
source = "pulumi/docker"
}
}
}
resource "docker_registryimage" "helloworld" {
name = docker_remoteimage.image.name
keep_remotely = true
}
resource "docker_remoteimage" "image" {
name = "registry.com/somename:1.0"
build = {
context ="${path.cwd}/absolutePathToContextFolder"
}
}
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 com.pulumi.docker.RegistryImage;
import com.pulumi.docker.RegistryImageArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 image = new RemoteImage("image", RemoteImageArgs.builder()
.name("registry.com/somename:1.0")
.build(RemoteImageBuildArgs.builder()
.context(String.format("%s/absolutePathToContextFolder", System.getProperty("user.dir")))
.build())
.build());
var helloworld = new RegistryImage("helloworld", RegistryImageArgs.builder()
.name(image.name())
.keepRemotely(true)
.build());
}
}
resources:
helloworld:
type: docker:RegistryImage
properties:
name: ${image.name}
keepRemotely: true
image:
type: docker:RemoteImage
properties:
name: registry.com/somename:1.0
build:
context: ${pulumi.cwd}/absolutePathToContextFolder
Constructors
- RegistryImage(String name, {RegistryImageArgs? args, CustomResourceOptions? options})
-
Creates a new RegistryImage.
nameThe Pulumi resource name.argsArguments used to configure this RegistryImage. The set of arguments for RegistryImage.optionsResource options controlling this resource's behavior. - RegistryImage.reference(String urn)
- Creates a typed reference to an existing RegistryImage resource.
Properties
-
authConfig
↔ Output<
RegistryImageAuthConfig?> -
Authentication configuration for the Docker registry. It is only used for this resource.
latefinal
-
build
↔ Output<
RegistryImageBuild?> -
Configuration to build an image. Requires the
Use containerd for pulling and storing imagesoption to be disabled in the Docker Host(https://github.com/kreuzwerker/terraform-provider-docker/issues/534). Please see docker build command reference too.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
insecureSkipVerify
↔ Output<
bool?> -
If
true, the verification of TLS certificates of the server/registry is disabled. Defaults tofalselatefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
keepRemotely
↔ Output<
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 registry on destroy operation. Defaults to
falselatefinal -
name
↔ Output<
String> -
The name of the Docker image.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sha256Digest
↔ Output<
String> -
The sha256 digest of the image.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
triggers
↔ Output<
Map< String, String> ?> -
A map of arbitrary strings that, when changed, will force the
docker.RegistryImageresource to be replaced. This can be used to repush a local imagelatefinal -
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {RegistryImageState? state, CustomResourceOptions? options}) → RegistryImage -
Gets an existing RegistryImage resource's state with the given
nameandid.