Skip to content
Latchkey

docker network rm: Remove Networks & In-Use Errors

Remove a user-defined network once nothing is attached.

docker network rm deletes networks. This page covers the active-endpoints error and how prune differs.

What it does

docker network rm removes one or more user-defined networks. A network with connected containers cannot be removed until they disconnect or stop.

Common usage

Terminal
docker network rm testnet
docker network prune -f                  # remove all unused networks

Common errors in CI

"error while removing network: network ... has active endpoints" means a container is still attached - stop/remove it first, then rm the network. You cannot remove the built-in bridge, host, or none. For bulk cleanup of leftover compose networks, docker network prune -f is simpler than individual rm.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →