2016-01-15 18:33:17 +01:00
|
|
|
---
|
|
|
|
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
|
|
|
|
|
|
|
|
```
|
|
|
|
# Creates a docker volume "shared_volume".
|
|
|
|
resource "docker_volume" "shared_volume" {
|
2017-02-18 23:48:50 +01:00
|
|
|
name = "shared_volume"
|
2016-01-15 18:33:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Reference the volume with ${docker_volume.shared_volume.name}
|
2017-02-18 23:48:50 +01:00
|
|
|
|
2016-01-15 18:33:17 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2016-01-30 22:23:35 +01:00
|
|
|
* `name` - (Optional, string) The name of the Docker volume (generated if not
|
|
|
|
provided).
|
2016-01-15 18:33:17 +01:00
|
|
|
* `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.
|