skip to Main Content

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


  1. 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 thedocker network prune command:

    Note that system networks such as bridge, host, and none will never be pruned

    From the Network containers tutorial page:

    Every installation of the Docker Engine automatically includes three default networks.
    […]
    The network named bridge is a special network. Unless you tell it otherwise, Docker always launches your containers in this network.

    This would mean that removing those networks would break some of Docker‘s networking features.

    Login or Signup to reply.
  2. 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….

    Bridge – All containers without –network options get created within
    bridge network only
    To verify this you can run following commands –

    docker run -it --rm --name=default-bridge-container1 busybox
    

    As above command does not have –network option then it will be create container default-bridge-container1 under bridge network. To verify this, Run

    docker network inspect bridge
    

    Under containers section of inspect command, you will see container name default-bridge-container1 with IP assigned to it from bridge subnet.

    Host – this option tells to use underlying host network

    None – Container with –network=none means container is running in
    isolation & it has no access to inward or outward network.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search