docker/network-rm

Remove Network

Remove one or more networks.

network
remove
cleanup

Command

docker network rm

Explanation

docker network rm removes specified networks by name or ID. Networks in use by containers cannot be deleted. docker network prune removes all unused networks automatically.

Common Use Cases

  • Clean up old or unused networks
  • Recreate network with updated configuration

Best Practices

  • Remove unused networks regularly
  • Use docker network prune carefully to avoid deleting shared networks

Common Mistakes to Avoid

  • Trying to delete networks still in use by containers

Troubleshooting

Problem: Error: network in use

Solution: Stop or disconnect all containers attached to the network before removal.

Examples

Remove a single network

docker network rm mynet

Remove all unused networks

docker network prune