docker-network
Manage Docker networks
TLDR
List all available and configured networks on Docker daemon
Create a user-defined network
Display detailed information about one or more networks
Connect a container to a network using a name or ID
Disconnect a container from a network
Remove all unused (not referenced by any container) networks
Remove one or more unused networks
SYNOPSIS
docker network COMMAND [OPTIONS]
Commands:
connect Connect container to network
create Create network
disconnect Disconnect container from network
inspect Inspect network(s)
ls List networks
prune Prune unused networks
rm Remove network(s)
PARAMETERS
--debug
Enable debug mode
--help
Print usage
-v, --verbose
Enable verbose output
--version
Print version information
DESCRIPTION
The docker network command manages networks for Docker containers, enabling isolated communication between containers, the host, or external networks.
Docker networks abstract connectivity, supporting drivers like bridge (default, single-host), overlay (multi-host/Swarm), host (shares host network), none (no network), macvlan, and ipvlan. Custom networks provide automatic DNS resolution using container names, improved isolation, and scalability for microservices.
Key uses include Docker Compose multi-container apps and Docker Swarm services. Subcommands handle creation, listing, inspection, connection/disconnection of containers to networks, removal, and pruning unused ones. Essential for secure, efficient container orchestration without manual iptables rules.
CAVEATS
Default networks (bridge, host, none) cannot be removed. Networks must have no connected containers to delete. Use docker network inspect to check usage.
NETWORK DRIVERS
bridge: Default single-host.
overlay: Multi-host, VXLAN encrypted.
host: No isolation.
none: Disable networking.
macvlan/ipvlan: L2/L3 host-like IPs.
HISTORY
Introduced in Docker 1.9.0 (November 2015) with libnetwork and Container Network Model (CNM). Evolved for Swarm mode in Docker 1.12+; drivers expanded in later releases for Kubernetes compatibility via plugins.
SEE ALSO
docker(1), docker-container(1), docker-network-create(1), docker-network-ls(1), bridge(8)


