Module pulumi_wasm_docker::volume
source · Expand description
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
§Typescript
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
const sharedVolume = new docker.Volume("sharedVolume", {});
§Python
import pulumi
import pulumi_docker as docker
shared_volume = docker.Volume("sharedVolume")
§C#
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Docker = Pulumi.Docker;
return await Deployment.RunAsync(() =>
{
var sharedVolume = new Docker.Volume("sharedVolume");
});
§Go
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, "sharedVolume", nil)
if err != nil {
return err
}
return nil
})
}
§Java
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.Volume;
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");
}
}
§YAML
resources:
sharedVolume:
type: docker: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
Structs§
- Use builder syntax to set the required parameters and finish by calling the method
Self::build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments