1. Packages
  2. Docker
  3. API Docs
  4. Network
Docker v4.5.0 published on Friday, Nov 17, 2023 by Pulumi

docker.Network

Explore with Pulumi AI

docker logo
Docker v4.5.0 published on Friday, Nov 17, 2023 by Pulumi

    docker.Network provides a docker network resource.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Docker = Pulumi.Docker;
    
    return await Deployment.RunAsync(() => 
    {
        var privateNetwork = new Docker.Network("privateNetwork");
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-docker/sdk/v4/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
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.docker.Network;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var privateNetwork = new Network("privateNetwork");
    
        }
    }
    
    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("privateNetwork", {});
    
    resources:
      privateNetwork:
        type: docker:Network
    

    Create 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,
                ipam_options: Optional[Mapping[str, Any]] = 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)
    public Network(String name, NetworkArgs args)
    public Network(String name, NetworkArgs args, CustomResourceOptions options)
    
    type: docker:Network
    properties: # The arguments to resource properties.
    options: # 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.
    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.
    name String
    The unique name of the resource.
    args NetworkArgs
    The arguments to resource properties.
    options 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<NetworkIpamConfig>

    The IPAM configuration options

    IpamDriver string

    Driver used by the custom IP scheme of the network. Defaults to default

    IpamOptions Dictionary<string, object>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    Ipv6 bool

    Enable IPv6 networking. Defaults to false.

    Labels List<NetworkLabel>

    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

    IpamOptions map[string]interface{}

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    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 List<NetworkIpamConfig>

    The IPAM configuration options

    ipamDriver String

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions Map<String,Object>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 Boolean

    Enable IPv6 networking. Defaults to false.

    labels List<NetworkLabel>

    User-defined key/value metadata

    name String

    The name of the Docker network.

    options Map<String,Object>

    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 NetworkIpamConfig[]

    The IPAM configuration options

    ipamDriver string

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions {[key: string]: any}

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 boolean

    Enable IPv6 networking. Defaults to false.

    labels NetworkLabel[]

    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

    ipam_options Mapping[str, Any]

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    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.

    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 List<Property Map>

    The IPAM configuration options

    ipamDriver String

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions Map<Any>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 Boolean

    Enable IPv6 networking. Defaults to false.

    labels List<Property Map>

    User-defined key/value metadata

    name String

    The name of the Docker network.

    options Map<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 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.

    id String

    The provider-assigned unique ID for this managed resource.

    scope String

    Scope of the network. One of swarm, global, or local.

    Look up 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,
            ipam_options: Optional[Mapping[str, Any]] = 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)
    public static Network get(String name, Output<String> id, NetworkState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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<NetworkIpamConfig>

    The IPAM configuration options

    IpamDriver string

    Driver used by the custom IP scheme of the network. Defaults to default

    IpamOptions Dictionary<string, object>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    Ipv6 bool

    Enable IPv6 networking. Defaults to false.

    Labels List<NetworkLabel>

    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

    IpamOptions map[string]interface{}

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    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 List<NetworkIpamConfig>

    The IPAM configuration options

    ipamDriver String

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions Map<String,Object>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 Boolean

    Enable IPv6 networking. Defaults to false.

    labels List<NetworkLabel>

    User-defined key/value metadata

    name String

    The name of the Docker network.

    options Map<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 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 NetworkIpamConfig[]

    The IPAM configuration options

    ipamDriver string

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions {[key: string]: any}

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 boolean

    Enable IPv6 networking. Defaults to false.

    labels NetworkLabel[]

    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

    ipam_options Mapping[str, Any]

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    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.

    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 List<Property Map>

    The IPAM configuration options

    ipamDriver String

    Driver used by the custom IP scheme of the network. Defaults to default

    ipamOptions Map<Any>

    Provide explicit options to the IPAM driver. Valid options vary with ipam_driver and refer to that driver's documentation for more details.

    ipv6 Boolean

    Enable IPv6 networking. Defaults to false.

    labels List<Property Map>

    User-defined key/value metadata

    name String

    The name of the Docker network.

    options Map<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.

    Supporting Types

    NetworkIpamConfig, NetworkIpamConfigArgs

    AuxAddress Dictionary<string, object>

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    Gateway string

    The IP address of the gateway

    IpRange string

    The ip range in CIDR form

    Subnet string

    The subnet in CIDR form

    AuxAddress map[string]interface{}

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    Gateway string

    The IP address of the gateway

    IpRange string

    The ip range in CIDR form

    Subnet string

    The subnet in CIDR form

    auxAddress Map<String,Object>

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    gateway String

    The IP address of the gateway

    ipRange String

    The ip range in CIDR form

    subnet String

    The subnet in CIDR form

    auxAddress {[key: string]: any}

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    gateway string

    The IP address of the gateway

    ipRange string

    The ip range in CIDR form

    subnet string

    The subnet in CIDR form

    aux_address Mapping[str, Any]

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    gateway str

    The IP address of the gateway

    ip_range str

    The ip range in CIDR form

    subnet str

    The subnet in CIDR form

    auxAddress Map<Any>

    Auxiliary IPv4 or IPv6 addresses used by Network driver

    gateway String

    The IP address of the gateway

    ipRange String

    The ip range in CIDR form

    subnet String

    The subnet in CIDR form

    NetworkLabel, NetworkLabelArgs

    Label string

    Name of the label

    Value string

    Value of the label

    Label string

    Name of the label

    Value string

    Value of the label

    label String

    Name of the label

    value String

    Value of the label

    label string

    Name of the label

    value string

    Value of the label

    label str

    Name of the label

    value str

    Value of the label

    label String

    Name of the label

    value String

    Value of the label

    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
    Docker pulumi/pulumi-docker
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the docker Terraform Provider.

    docker logo
    Docker v4.5.0 published on Friday, Nov 17, 2023 by Pulumi