Docker networking is basically used for establishing communication between Docker containers and the outside of Docker. During the testing or development process, we can quickly accumulate numerous unused networks that take a disk space and can be removed. This tutorial shows how to remove Docker network.
To remove network by its ID or name, use
docker network command with
rm argument. For example, to remove the
eth0 network, you can run the following command:
docker network rm eth0
Note that cannot to remove a network that is used by Docker container. The network should be disconnected from any containers connected to it.
Remove multiple networks
There is a way to remove multiple networks at a time by specifying ID or name of the networks.
docker network rm eth0 eth1