mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2026-02-12 07:13:28 -05:00
58 lines
1.4 KiB
Markdown
58 lines
1.4 KiB
Markdown
---
|
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
|
page_title: "docker_volume Resource - terraform-provider-docker"
|
|
subcategory: ""
|
|
description: |-
|
|
Creates and destroys a volume in Docker. This can be used alongside docker_container to prepare volumes that can be shared across containers.
|
|
---
|
|
|
|
# docker_volume (Resource)
|
|
|
|
Creates and destroys a volume in Docker. This can be used alongside [docker_container](/docs/providers/docker/r/container.html) to prepare volumes that can be shared across containers.
|
|
|
|
## Example Usage
|
|
|
|
```terraform
|
|
# Creates a docker volume "shared_volume".
|
|
resource "docker_volume" "shared_volume" {
|
|
name = "shared_volume"
|
|
}
|
|
|
|
# Reference the volume with ${docker_volume.shared_volume.name}
|
|
```
|
|
|
|
<!-- schema generated by tfplugindocs -->
|
|
## Schema
|
|
|
|
### Optional
|
|
|
|
- **driver** (String)
|
|
- **driver_opts** (Map of String)
|
|
- **id** (String) The ID of this resource.
|
|
- **labels** (Block Set) (see [below for nested schema](#nestedblock--labels))
|
|
- **name** (String)
|
|
|
|
### Read-Only
|
|
|
|
- **mountpoint** (String)
|
|
|
|
<a id="nestedblock--labels"></a>
|
|
### Nested Schema for `labels`
|
|
|
|
Required:
|
|
|
|
- **label** (String) Name of the label
|
|
- **value** (String) Value of the label
|
|
|
|
## Import
|
|
|
|
Import is supported using the following syntax:
|
|
|
|
```shell
|
|
#!/bin/bash
|
|
|
|
# Docker volume can be imported using the long id,
|
|
# e.g. for a volume with the short id `ecae276c5`:
|
|
|
|
terraform import docker_volume.foo "$(docker volume inspect -f {{.ID}} eca)"
|
|
```
|