LinuxCommandLibrary

docker-network

manage container networking and connectivity

TLDR

List networks

$ docker network ls
copy
Create a network
$ docker network create [name]
copy
Create bridge network with subnet
$ docker network create --driver bridge --subnet [192.168.1.0/24] [name]
copy
Connect container to network
$ docker network connect [network] [container]
copy
Disconnect container
$ docker network disconnect [network] [container]
copy
Inspect network
$ docker network inspect [network]
copy
Remove network
$ docker network rm [network]
copy

SYNOPSIS

docker network command [options]

DESCRIPTION

docker network manages Docker networks. Networks enable communication between containers. Supports bridge, host, overlay, and macvlan drivers. Containers on the same user-defined network can communicate using container names as hostnames, providing service discovery. Custom networks isolate containers and provide better security than the default bridge network.

SUBCOMMANDS

ls

List networks.
create
Create a network.
rm
Remove networks.
inspect
Display detailed information.
connect
Connect container to network.
disconnect
Disconnect container from network.
prune
Remove unused networks.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community