Docker v4.1.0, Mar 23 23
Docker
The Pulumi Docker Provider can be used to provision and interact with any of the resources available in Docker including containers, images, networks, volumes and more.
Example
const docker = require("@pulumi/docker")
const image = new docker.RemoteImage("ubuntu", {
name: "ubuntu:precise"
});
const container = new docker.Container("ubuntu", {
image: image.latest,
});
import * as docker from "@pulumi/docker";
const image = new docker.RemoteImage("ubuntu", {
name: "ubuntu:precise"
});
const container = new docker.Container("ubuntu", {
image: image.latest,
});
import pulumi_docker as docker
image = docker.RemoteImage("ubuntu",
name='ubuntu:precise'
)
container = docker.Container("ubuntu",
image=image.latest
)
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
do "github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
image, err := do.NewRemoteImage(ctx, "ubuntu", &docker.RemoteImageArgs{
Name: pulumi.String("ubuntu:precise"),
})
if err != nil {
return err
}
container, err := do.NewContainer(ctx, "ubuntu", &docker.ContainerArgs{
Image: image.Latest(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;
using Pulumi.Docker;
await Deployment.RunAsync(() =>
{
var image = new Docker.RemoteImage("ubuntu", new Docker.RemoteImageArgs
{
Name = "ubuntu:precise",
});
var container = new Docker.Container("ubuntu", new Docker.ContainerArgs
{
Image = image.Latest,
});
});
resources:
image:
type: docker:RemoteImage
properties:
name: ubuntu:precise
container:
type: docker:Container
properties:
image: ${image.latest}