mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2026-01-24 07:32:55 -05:00
* build: adds local check for website links * build(make): adds website lint and setup target * docs: fix spellings and hcl blocks * fix(make): phony cmd for missing targets * chore: renames website link check workflow * fix: missing workflow path * build(make): adds golangci-lint target and tool * ci: adds website lint workflow * docs(contributing): adds linter runs * chore: improves naming of workflow jobs * ci: moves website lint job * chore: switches markdown checker imagee to ghcr.io/tcort/markdown-link-check:stable
49 lines
1.3 KiB
Markdown
49 lines
1.3 KiB
Markdown
---
|
|
layout: "docker"
|
|
page_title: "Docker: docker_volume"
|
|
sidebar_current: "docs-docker-resource-volume"
|
|
description: |-
|
|
Creates and destroys docker volumes.
|
|
---
|
|
|
|
# docker\_volume
|
|
|
|
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
|
|
|
|
```hcl
|
|
# Creates a docker volume "shared_volume".
|
|
resource "docker_volume" "shared_volume" {
|
|
name = "shared_volume"
|
|
}
|
|
|
|
# Reference the volume with ${docker_volume.shared_volume.name}
|
|
|
|
```
|
|
|
|
## Argument Reference
|
|
|
|
The following arguments are supported:
|
|
|
|
* `name` - (Optional, string) The name of the Docker volume (generated if not
|
|
provided).
|
|
* `labels` - (Optional, map of string/string key/value pairs) User-defined key/value metadata.
|
|
* `driver` - (Optional, string) Driver type for the volume (defaults to local).
|
|
* `driver_opts` - (Optional, map of strings) Options specific to the driver.
|
|
|
|
## Attributes Reference
|
|
|
|
The following attributes are exported in addition to the above configuration:
|
|
|
|
* `mountpoint` (string) - The mountpoint of the volume.
|
|
|
|
## Import
|
|
|
|
Docker volume can be imported using the long id, e.g. for a volume with the short id `ecae276c5`:
|
|
|
|
```sh
|
|
$ terraform import docker_volume.foo $(docker volume inspect -f {{.ID}} eca)
|
|
```
|