Remote Image Args
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
Finds and downloads the latest ubuntu:precise
image but does not check for further updates of the image
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());
}
}
Dynamic updates
To be able to update an image dynamically when the sha256
sum changes, you need to use it in combination with docker.RegistryImage
as follows:
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());
}
}
Properties
Configuration to build an image. Please see docker build command reference too.
If true, then the image is removed forcibly when the resource is destroyed.
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.
A value which cause an image pull when changed
List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the dockerregistryimage.