Reputation: 2997
We are using docker in our CI environment a create a lot of networks using docker network create
. As now I see, we don't removed that networks again using docker network rm
.
Might that be a problem? Or is docker clever enough to automatically remove orphan networks?
Upvotes: 0
Views: 1105
Reputation: 367
Docker will keep it until you remove it.
There are acouple of usefull commands to remove unused stuff, like
docker system prune -fa
or docker network prune
to only delete unused networks.
you can create a crontab in the host to run those commands periodically...
Upvotes: 1
Reputation: 1722
The network will remain on your system until you manually remove it. Docker will not automatically 'garbage-collect' unused object. This applies to all docker objects like images, containers, volumes and networks.
But docker provides an easy way to remove objects, that are not used. To remove all unused networks you can use docker network prune
.
See this page from the docker config for more information.
Might that be a problem?
Any docker-network on your system may create entries to iptables (or windows routing rules, depending on the host system you use), routing table entries and virtual network devices (bridges). These things will remain on your system unless you remove the network. But this shouldn't be much of a problem since it doesn't take up much system resources
Upvotes: 1