← 返回命令列表

Linux command

docker-network 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

List networks

docker network ls

Create a network

docker network create [name]

Create bridge network with subnet

docker network create --driver bridge --subnet [192.168.1.0/24] [name]

Connect container to network

docker network connect [network] [container]

Disconnect container

docker network disconnect [network] [container]

Inspect network

docker network inspect [network]

Remove network

docker network rm [network]

说明

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.

FAQ

What is the docker-network command used for?

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.

How do I run a basic docker-network example?

Run `docker network ls` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more docker-network examples?

This page includes 7 examples for docker-network, plus related commands for nearby Linux tasks.