删除docker多余的网络接口

docker network
输出
Usage: docker network COMMAND
Manage networks
Commands:
connect Connect a container to a network
create Create a network
disconnect Disconnect a container from a network
inspect Display detailed information on one or more networks
ls List networks
prune Remove all unused networks
rm Remove one or more networks
Run ‘docker network COMMAND –help’ for more information on a command.

docker network ls #列表
输出
NETWORK ID NAME DRIVER SCOPE
570aa00b4993 1panel-network bridge local
96c43c65055c bridge bridge local
d79eb8059fa6 facefusion-docker_default bridge local
dec4c4dcc288 host host local
ef13ce84ff20 navidrome_default bridge local
8f584c65131f none null local
21e45a60fd2a openwrt macvlan local

docker network inspect 96c43c65055c #查看
输出

[
{
“Name”: “bridge”,
“Id”: “96c43c65055ccbc04b7130aa1e430758a0d1e83b0b5088f6f4689753ac019fba”,
“Created”: “2024-11-19T22:04:32.919431129+08:00”,
“Scope”: “local”,
“Driver”: “bridge”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: null,
“Config”: [
{
“Subnet”: “172.17.0.0/16”,
“Gateway”: “172.17.0.1”
}
]
},
“Internal”: false,
“Attachable”: false,
“Ingress”: false,
“ConfigFrom”: {
“Network”: “”
},
“ConfigOnly”: false,
“Containers”: {
“73b570230b169dcf763832950b0cb18761d60a090409eaa5771b588922fe45ae”: {
“Name”: “freshrss1”,
“EndpointID”: “3200f57026d38d0660d5595e36623422a5c3fb832c7438c06fd276ee1da44e6f”,
“MacAddress”: “02:42:ac:11:00:03”,
“IPv4Address”: “172.17.0.3/16”,
“IPv6Address”: “”
},
“c61273c4fa0109cc5e4ff85c06f2662174f689100af52a5dcb885c21f5ff8699”: {
“Name”: “navidrome”,
“EndpointID”: “23343fea4a3f19c150d9526b83c5bc3d13598a8008efa044712455a7da173931”,
“MacAddress”: “02:42:ac:11:00:02”,
“IPv4Address”: “172.17.0.2/16”,
“IPv6Address”: “”
}
},
“Options”: {
“com.docker.network.bridge.default_bridge”: “true”,
“com.docker.network.bridge.enable_icc”: “true”,
“com.docker.network.bridge.enable_ip_masquerade”: “true”,
“com.docker.network.bridge.host_binding_ipv4”: “0.0.0.0”,
“com.docker.network.bridge.name”: “docker0”,
“com.docker.network.driver.mtu”: “1500”
},
“Labels”: {}
}
]

docker network rm 1panel-network #删掉
输出
1panel-network
docker network prune #删掉所有没用的
输出
WARNING! This will remove all custom networks not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Networks:
navidrome_default

慎用,很危险的功能。