Overview
Creates a new Docker network with the specified configuration. This endpoint supports all network drivers including bridge, overlay, macvlan, and custom drivers.
Authentication
This endpoint requires authentication via cookies. The user must have the networks:create permission for the specified environment.
Query Parameters
The environment ID where the network will be created. Required parameter.
Request Body
Network name. Must be unique within the environment.
Network driver to use. Options: bridge, host, overlay, macvlan, ipvlan, or custom driver name.
Whether to restrict external access to the network. Internal networks have no connectivity to external networks.
Enable manual container attachment. Useful for swarm overlay networks that need standalone container access.
Create as swarm ingress network. Only one ingress network can exist per swarm.
Network driver options as key-value pairs. Bridge Driver:
com.docker.network.bridge.name: Custom bridge name
com.docker.network.bridge.enable_icc: Enable inter-container connectivity (true/false)
com.docker.network.bridge.enable_ip_masquerade: Enable IP masquerading (true/false)
com.docker.network.bridge.host_binding_ipv4: Default IP when binding ports
Macvlan Driver:
parent: Parent interface (e.g., “eth0”)
macvlan_mode: Mode (bridge/vepa/passthru/private)
Overlay Driver:
encrypted: Enable encryption (“true”/“false”)
User-defined labels as key-value pairs for organizing and identifying networks.
IP Address Management (IPAM) configuration. Array of IPAM configuration objects. Subnet in CIDR format (e.g., “172.18.0.0/16”)
Gateway IP address (e.g., “172.18.0.1”)
IP range to allocate container IPs from (e.g., “172.18.5.0/24”)
IPAM driver-specific options.
Response
Whether the network was created successfully
The ID of the newly created network
Error Responses
400 Validation Error
403 Permission Denied
403 Environment Access Denied
500 Server Error
{
"error" : "Network name is required"
}
cURL - Basic
cURL - With IPAM
JavaScript
Python
curl -X POST 'https://your-dockhand.com/api/networks?env=1' \
-H 'Content-Type: application/json' \
-H 'Cookie: session=your-session-cookie' \
-d '{
"name": "app-network",
"driver": "bridge"
}'
{
"success" : true ,
"id" : "c7b9a6e5f8d3a1b2c3d4e5f6"
}
Examples
Bridge Network
Create a standard bridge network for container communication:
{
"name" : "app-network" ,
"driver" : "bridge" ,
"ipam" : {
"config" : [{
"subnet" : "172.18.0.0/16" ,
"gateway" : "172.18.0.1"
}]
}
}
Overlay Network (Swarm)
Create an encrypted overlay network for swarm services:
{
"name" : "swarm-overlay" ,
"driver" : "overlay" ,
"attachable" : true ,
"ipam" : {
"config" : [{
"subnet" : "10.0.9.0/24" ,
"gateway" : "10.0.9.1"
}]
},
"options" : {
"encrypted" : "true"
}
}
Macvlan Network
Create a macvlan network for containers that need physical network presence:
{
"name" : "macvlan-net" ,
"driver" : "macvlan" ,
"ipam" : {
"config" : [{
"subnet" : "192.168.1.0/24" ,
"gateway" : "192.168.1.1" ,
"ipRange" : "192.168.1.200/28"
}]
},
"options" : {
"parent" : "eth0" ,
"macvlan_mode" : "bridge"
}
}
Internal Network
Create an internal network with no external connectivity:
{
"name" : "backend-internal" ,
"driver" : "bridge" ,
"internal" : true ,
"ipam" : {
"config" : [{
"subnet" : "172.19.0.0/16" ,
"gateway" : "172.19.0.1"
}]
}
}
Notes
Network names must be unique within the environment
The name field is required; all other fields are optional
Default driver is bridge if not specified
IPAM configuration is optional; Docker will auto-assign if not provided
Network creation is audited with the user, action, and network details
Built-in networks (bridge, host, none) cannot be created as they already exist
For overlay networks, Docker must be running in swarm mode