2016-01-02 12:20:55 +01:00
|
|
|
---
|
|
|
|
layout: "docker"
|
|
|
|
page_title: "Docker: docker_network"
|
|
|
|
sidebar_current: "docs-docker-resource-network"
|
|
|
|
description: |-
|
|
|
|
Manages a Docker Network.
|
|
|
|
---
|
|
|
|
|
|
|
|
# docker\_network
|
|
|
|
|
|
|
|
Manages a Docker Network. This can be used alongside
|
|
|
|
[docker\_container](/docs/providers/docker/r/container.html)
|
|
|
|
to create virtual networks within the docker environment.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
# Find the latest Ubuntu precise image.
|
|
|
|
resource "docker_network" "private_network" {
|
|
|
|
name = "my_network"
|
|
|
|
}
|
|
|
|
|
2016-01-30 22:23:35 +01:00
|
|
|
# Access it somewhere else with ${docker_network.private_network.name}
|
2016-01-02 12:20:55 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required, string) The name of the Docker network.
|
2016-01-30 22:23:35 +01:00
|
|
|
* `check_duplicate` - (Optional, boolean) Requests daemon to check for networks
|
|
|
|
with same name.
|
|
|
|
* `driver` - (Optional, string) Name of the network driver to use. Defaults to
|
|
|
|
`bridge` driver.
|
|
|
|
* `options` - (Optional, map of strings) Network specific options to be used by
|
|
|
|
the drivers.
|
2017-01-03 12:46:16 +01:00
|
|
|
* `internal` - (Optional, boolean) Restrict external access to the network.
|
|
|
|
Defaults to `false`.
|
2016-01-30 22:23:35 +01:00
|
|
|
* `ipam_driver` - (Optional, string) Driver used by the custom IP scheme of the
|
|
|
|
network.
|
|
|
|
* `ipam_config` - (Optional, block) See [IPAM config](#ipam_config) below for
|
|
|
|
details.
|
|
|
|
|
|
|
|
<a id="ipam_config"></a>
|
|
|
|
### IPAM config
|
|
|
|
Configuration of the custom IP scheme of the network.
|
2016-01-02 12:20:55 +01:00
|
|
|
|
|
|
|
The `ipam_config` block supports:
|
|
|
|
|
|
|
|
* `subnet` - (Optional, string)
|
|
|
|
* `ip_range` - (Optional, string)
|
|
|
|
* `gateway` - (Optional, string)
|
|
|
|
* `aux_address` - (Optional, map of string)
|
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported in addition to the above configuration:
|
|
|
|
|
|
|
|
* `id` (string)
|
|
|
|
* `scope` (string)
|