Forrest logo
back to the docker tool

docker:tldr:3174d

docker: Remove all unused (not referenced by any container) networks.
$ docker network prune
try on your machine

The command "docker network prune" is used to remove all the unused networks on a Docker host.

In Docker, networks are used to allow communication between containers. When containers are created, they can be connected to one or more networks using the "--network" option. Over time, the number of networks on a Docker host can accumulate as containers are created, used, and deleted.

The "docker network prune" command helps to clean up these unused networks. This command identifies networks on the Docker host that are not currently being used by any containers and removes them. Unused networks are those that do not have any containers connected to them.

It is important to note that removing a network may interrupt or disrupt any communication or services that are relying on that network. Therefore, it is recommended to exercise caution when using this command, especially in production environments.

To use the "docker network prune" command, simply run it in the terminal or command prompt. Docker will scan the Docker host for unused networks and prompt for confirmation before removing them.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool