CentOS 7
Docker 20.10
I want to delete all networks.
docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
As you can see no containers. I was removed it before.
I try this:
docker network ls
NETWORK ID NAME DRIVER SCOPE
1b6758d38df3 bridge bridge local
89dea066d590 host host local
8e235018309e none null local
And this:
docker network rm 1b6758d38df3
Error response from daemon: bridge is a pre-defined network and cannot be removed
P.S the folder /var/lib/docker
is empty
2
Answers
Those are the system networks included in every Docker installation, they are not like user-defined networks and cannot be removed.
From the docs for the
docker network prune
command:From the Network containers tutorial page:
This would mean that removing those networks would break some of Docker‘s networking features.
For what purpose do you want to remove/delete default network provided by Docker… Please share your use case so some one from community can guide you accordingly…
Bridge, Host & None are default & pre defined network… These networks are created during installation of docker….
As above command does not have –network option then it will be create container default-bridge-container1 under bridge network. To verify this, Run
Under containers section of inspect command, you will see container name default-bridge-container1 with IP assigned to it from bridge subnet.