Volume

class Volume : KotlinCustomResource

Creates and destroys a volume in Docker. This can be used alongside docker.Container to prepare volumes that can be shared across containers.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
const sharedVolume = new docker.Volume("shared_volume", {name: "shared_volume"});
import pulumi
import pulumi_docker as docker
shared_volume = docker.Volume("shared_volume", name="shared_volume")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Docker = Pulumi.Docker;
return await Deployment.RunAsync(() =>
{
var sharedVolume = new Docker.Volume("shared_volume", new()
{
Name = "shared_volume",
});
});
package main
import (
"github.com/pulumi/pulumi-docker/sdk/v4/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := docker.NewVolume(ctx, "shared_volume", &docker.VolumeArgs{
Name: pulumi.String("shared_volume"),
})
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.Volume;
import com.pulumi.docker.VolumeArgs;
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 sharedVolume = new Volume("sharedVolume", VolumeArgs.builder()
.name("shared_volume")
.build());
}
}
resources:
sharedVolume:
type: docker:Volume
name: shared_volume
properties:
name: shared_volume

Import

Example

Assuming you created a volume as follows #!/bin/bash docker volume create prints the long ID 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d you provide the definition for the resource as follows terraform resource "docker_volume" "foo" { name = "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d" } then the import command is as follows #!/bin/bash

$ pulumi import docker:index/volume:Volume foo 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d

Properties

Link copied to clipboard
val driver: Output<String>

Driver type for the volume. Defaults to local.

Link copied to clipboard
val driverOpts: Output<Map<String, String>>?

Options specific to the driver.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val labels: Output<List<VolumeLabel>>?

User-defined key/value metadata

Link copied to clipboard
val mountpoint: Output<String>

The mountpoint of the volume.

Link copied to clipboard
val name: Output<String>

The name of the Docker volume (will be generated if not provided).

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>