Network

docker.Network provides details about a specific Docker Network.

Schema

Required

  • name (String) The name of the Docker network.

Optional

  • attachable (Boolean) Enable manual container attachment to the network.
  • check_duplicate (Boolean) Requests daemon to check for networks with same name.
  • driver (String) The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
  • id (String) The ID of this resource.
  • ingress (Boolean) Create swarm routing-mesh network. Defaults to false.
  • internal (Boolean) Whether the network is internal.
  • ipam_config (Block Set) The IPAM configuration options (see below for nested schema)
  • ipam_driver (String) Driver used by the custom IP scheme of the network. Defaults to default
  • ipv6 (Boolean) Enable IPv6 networking. Defaults to false.
  • labels (Block Set) User-defined key/value metadata (see below for nested schema)
  • options (Map of String) Only available with bridge networks. See bridge options docs for more details.

Read-Only

  • scope (String) Scope of the network. One of swarm, global, or local.

Nested Schema for ipam_config

Optional:

  • aux_address (Map of String) Auxiliary IPv4 or IPv6 addresses used by Network driver
  • gateway (String) The IP address of the gateway
  • ip_range (String) The ip range in CIDR form
  • subnet (String) The subnet in CIDR form

Nested Schema for labels

Required:

  • label (String) Name of the label
  • value (String) Value of the label

Example Usage

using Pulumi;
using Docker = Pulumi.Docker;

class MyStack : Stack
{
    public MyStack()
    {
        var privateNetwork = new Docker.Network("privateNetwork", new Docker.NetworkArgs
        {
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := docker.NewNetwork(ctx, "privateNetwork", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_docker as docker

private_network = docker.Network("privateNetwork")
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

const privateNetwork = new docker.Network("private_network", {});

Create a Network Resource

new Network(name: string, args?: NetworkArgs, opts?: CustomResourceOptions);
@overload
def Network(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            attachable: Optional[bool] = None,
            check_duplicate: Optional[bool] = None,
            driver: Optional[str] = None,
            ingress: Optional[bool] = None,
            internal: Optional[bool] = None,
            ipam_configs: Optional[Sequence[NetworkIpamConfigArgs]] = None,
            ipam_driver: Optional[str] = None,
            ipv6: Optional[bool] = None,
            labels: Optional[Sequence[NetworkLabelArgs]] = None,
            name: Optional[str] = None,
            options: Optional[Mapping[str, Any]] = None)
@overload
def Network(resource_name: str,
            args: Optional[NetworkArgs] = None,
            opts: Optional[ResourceOptions] = None)
func NewNetwork(ctx *Context, name string, args *NetworkArgs, opts ...ResourceOption) (*Network, error)
public Network(string name, NetworkArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Network Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Network resource accepts the following input properties:

Attachable bool
Enable manual container attachment to the network.
CheckDuplicate bool
Requests daemon to check for networks with same name.
Driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
Ingress bool
Create swarm routing-mesh network. Defaults to false.
Internal bool
Whether the network is internal.
IpamConfigs List<NetworkIpamConfigArgs>
The IPAM configuration options
IpamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
Ipv6 bool
Enable IPv6 networking. Defaults to false.
Labels List<NetworkLabelArgs>
User-defined key/value metadata
Name string
The name of the Docker network.
Options Dictionary<string, object>
Only available with bridge networks. See bridge options docs for more details.
Attachable bool
Enable manual container attachment to the network.
CheckDuplicate bool
Requests daemon to check for networks with same name.
Driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
Ingress bool
Create swarm routing-mesh network. Defaults to false.
Internal bool
Whether the network is internal.
IpamConfigs []NetworkIpamConfigArgs
The IPAM configuration options
IpamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
Ipv6 bool
Enable IPv6 networking. Defaults to false.
Labels []NetworkLabelArgs
User-defined key/value metadata
Name string
The name of the Docker network.
Options map[string]interface{}
Only available with bridge networks. See bridge options docs for more details.
attachable boolean
Enable manual container attachment to the network.
checkDuplicate boolean
Requests daemon to check for networks with same name.
driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
ingress boolean
Create swarm routing-mesh network. Defaults to false.
internal boolean
Whether the network is internal.
ipamConfigs NetworkIpamConfigArgs[]
The IPAM configuration options
ipamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
ipv6 boolean
Enable IPv6 networking. Defaults to false.
labels NetworkLabelArgs[]
User-defined key/value metadata
name string
The name of the Docker network.
options {[key: string]: any}
Only available with bridge networks. See bridge options docs for more details.
attachable bool
Enable manual container attachment to the network.
check_duplicate bool
Requests daemon to check for networks with same name.
driver str
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
ingress bool
Create swarm routing-mesh network. Defaults to false.
internal bool
Whether the network is internal.
ipam_configs Sequence[NetworkIpamConfigArgs]
The IPAM configuration options
ipam_driver str
Driver used by the custom IP scheme of the network. Defaults to default
ipv6 bool
Enable IPv6 networking. Defaults to false.
labels Sequence[NetworkLabelArgs]
User-defined key/value metadata
name str
The name of the Docker network.
options Mapping[str, Any]
Only available with bridge networks. See bridge options docs for more details.

Outputs

All input properties are implicitly available as output properties. Additionally, the Network resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Scope string
Scope of the network. One of swarm, global, or local.
Id string
The provider-assigned unique ID for this managed resource.
Scope string
Scope of the network. One of swarm, global, or local.
id string
The provider-assigned unique ID for this managed resource.
scope string
Scope of the network. One of swarm, global, or local.
id str
The provider-assigned unique ID for this managed resource.
scope str
Scope of the network. One of swarm, global, or local.

Look up an Existing Network Resource

Get an existing Network resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkState, opts?: CustomResourceOptions): Network
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attachable: Optional[bool] = None,
        check_duplicate: Optional[bool] = None,
        driver: Optional[str] = None,
        ingress: Optional[bool] = None,
        internal: Optional[bool] = None,
        ipam_configs: Optional[Sequence[NetworkIpamConfigArgs]] = None,
        ipam_driver: Optional[str] = None,
        ipv6: Optional[bool] = None,
        labels: Optional[Sequence[NetworkLabelArgs]] = None,
        name: Optional[str] = None,
        options: Optional[Mapping[str, Any]] = None,
        scope: Optional[str] = None) -> Network
func GetNetwork(ctx *Context, name string, id IDInput, state *NetworkState, opts ...ResourceOption) (*Network, error)
public static Network Get(string name, Input<string> id, NetworkState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Attachable bool
Enable manual container attachment to the network.
CheckDuplicate bool
Requests daemon to check for networks with same name.
Driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
Ingress bool
Create swarm routing-mesh network. Defaults to false.
Internal bool
Whether the network is internal.
IpamConfigs List<NetworkIpamConfigArgs>
The IPAM configuration options
IpamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
Ipv6 bool
Enable IPv6 networking. Defaults to false.
Labels List<NetworkLabelArgs>
User-defined key/value metadata
Name string
The name of the Docker network.
Options Dictionary<string, object>
Only available with bridge networks. See bridge options docs for more details.
Scope string
Scope of the network. One of swarm, global, or local.
Attachable bool
Enable manual container attachment to the network.
CheckDuplicate bool
Requests daemon to check for networks with same name.
Driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
Ingress bool
Create swarm routing-mesh network. Defaults to false.
Internal bool
Whether the network is internal.
IpamConfigs []NetworkIpamConfigArgs
The IPAM configuration options
IpamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
Ipv6 bool
Enable IPv6 networking. Defaults to false.
Labels []NetworkLabelArgs
User-defined key/value metadata
Name string
The name of the Docker network.
Options map[string]interface{}
Only available with bridge networks. See bridge options docs for more details.
Scope string
Scope of the network. One of swarm, global, or local.
attachable boolean
Enable manual container attachment to the network.
checkDuplicate boolean
Requests daemon to check for networks with same name.
driver string
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
ingress boolean
Create swarm routing-mesh network. Defaults to false.
internal boolean
Whether the network is internal.
ipamConfigs NetworkIpamConfigArgs[]
The IPAM configuration options
ipamDriver string
Driver used by the custom IP scheme of the network. Defaults to default
ipv6 boolean
Enable IPv6 networking. Defaults to false.
labels NetworkLabelArgs[]
User-defined key/value metadata
name string
The name of the Docker network.
options {[key: string]: any}
Only available with bridge networks. See bridge options docs for more details.
scope string
Scope of the network. One of swarm, global, or local.
attachable bool
Enable manual container attachment to the network.
check_duplicate bool
Requests daemon to check for networks with same name.
driver str
The driver of the Docker network. Possible values are bridge, host, overlay, macvlan. See network docs for more details.
ingress bool
Create swarm routing-mesh network. Defaults to false.
internal bool
Whether the network is internal.
ipam_configs Sequence[NetworkIpamConfigArgs]
The IPAM configuration options
ipam_driver str
Driver used by the custom IP scheme of the network. Defaults to default
ipv6 bool
Enable IPv6 networking. Defaults to false.
labels Sequence[NetworkLabelArgs]
User-defined key/value metadata
name str
The name of the Docker network.
options Mapping[str, Any]
Only available with bridge networks. See bridge options docs for more details.
scope str
Scope of the network. One of swarm, global, or local.

Supporting Types

NetworkIpamConfig

AuxAddress Dictionary<string, object>
Gateway string
IpRange string
Subnet string
AuxAddress map[string]interface{}
Gateway string
IpRange string
Subnet string
auxAddress {[key: string]: any}
gateway string
ipRange string
subnet string
aux_address Mapping[str, Any]
gateway str
ip_range str
subnet str

NetworkLabel

Label string
Value string
Label string
Value string
label string
value string
label str
value str

Import

Example Assuming you created a network as follows #!/bin/bash docker network create foo # prints the long ID 87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73 you provide the definition for the resource as follows terraform resource “docker_network” “foo” {

name = “foo” } then the import command is as follows #!/bin/bash

 $ pulumi import docker:index/network:Network foo 87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73

Package Details

Repository
https://github.com/pulumi/pulumi-docker
License
Apache-2.0
Notes
This Pulumi package is based on the docker Terraform Provider.