Skip to main content

Docker Network Commands

These commands let you manage container networking. You can create, list, inspect, connect, disconnect, and remove networks. Networks allow containers to communicate with each other and with external systems in a secure, flexible way.

docker network → Manage networks

docker network create → Create a network

docker network ls → List networks

docker network inspect → Display detailed information on one or more networks

docker network connect → Connect a container to a network

docker network disconnect → Disconnect a container from a network

docker network rm → Remove one or more networks

docker network prune → Remove all unused networks


Docker Network

docker network →  Manage networks
Usage   : docker network

Docker network create

docker network create → Create a network
Usage   : docker network create [OPTIONS] NETWORK
Aliases : NA

Description:

  • Creates a new network for containers.
  • Drivers:bridge → default, isolated to one Docker Engine.overlay → spans multiple Docker hosts (requires Swarm mode).You can also use custom drivers.
  • If no driver is given, Docker makes a bridge network automatically (docker0).
  • New containers connect to the default bridge unless you specify another network.
  • Swarm overlay networks:By default, only swarm services can attach.Use --attachable to also allow manually started containers.
  • Rules:Network names must be unique (Docker tries to detect conflicts, but you must avoid them).
  • Limitations:Overlay networks use /24 blocks (max 256 IPs).For more IPs, use dnsrr mode with a load balancer or multiple smaller overlay networks.
docker network create
″”

Docker network ls

docker network ls → List networks
Usage   : docker network ls [OPTIONS]
Aliases : dockert network list

Description:

  • Lists all the networks known to the Docker Engine daemon .
  • Includes local networks and those that span across multiple hosts in a Swarm cluster.
docker network ls
″”

Docker network inspect

docker network inspect → Display detailed information on one or more networks
Usage   : docker network inspect [OPTIONS] NETWORK [NETWORK...]
Aliases : NA

Description:

  • Shows detailed information about one or more networks.
  • By default, results are displayed as a JSON object but you can use formatting options to customize the output.
docker network inspect
″”

Docker network connect

docker network connect → Connect a container to a network
Usage   : docker network connect [OPTIONS] NETWORK CONTAINER
Aliases : NA

Description:

  • You can specify the container by name or ID while connecting a container to a network.
  • Once connected, the container can communicate with other containers in the same network.
docker network connect
″”

Docker network disconnect

docker network connect → Connect a container to a network
Usage   : docker network connect [OPTIONS] NETWORK CONTAINER
Aliases : NA

Description:

  • The container must be running to be disconnected while disconnecting a container from a network.
docker network disconnect
″”

Docker network rm

docker network rm → Remove one or more networks
Usage   : docker network rm NETWORK [NETWORK...]
Aliases : docker network remove

Description:

  • Removes one or more networks (by name or ID).
  • To remove a network, you must first disconnect all containers using it.
docker network rm
″”

Docker network prune

docker network prune → Remove all unused networks
Usage   : docker network prune [OPTIONS]
Aliases : NA

Description:

  • Removes all unused networks.
  • Unused networks = those not referenced by any containers.
docker network prune
″”


Updated on Dec 10, 2025