Docker Community Forums

Share and learn in the Docker community.

Cannot delete docker network

I have a similar issue as this person but I noticed there was 0 help, so trying this again

docker network list
bb265d4c1f3d bridge bridge local
5e5173c44d6d host host local
0d94718b7dfe mac0 null local
b550d12ce92f none null local

docker network rm mac0
Error response from daemon: error while removing network: configuration network “mac0” is in use

docker network inspect mac0

“Name”: “mac0”,
“Id”: “0d94718b7dfe968d59cc7921d4b320e66388f20e0bbf09a7185d842ca6fa4d75”,
“Created”: “2021-01-03T14:37:56.281038897-08:00”,
“Scope”: “local”,
“Driver”: “null”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: null,
“Config”: [
“Subnet”: “”,
“IPRange”: “”,
“Gateway”: “”
“Internal”: false,
“Attachable”: false,
“Ingress”: false,
“ConfigFrom”: {
“Network”: “”
“ConfigOnly”: true,
“Containers”: {},
“Options”: {
“parent”: “ovs_eth4”
“Labels”: {}

As you can see, there are no containers connected to this network. Is there some manual way to remove it or some wildcard I can use for the containerID?

Since you seem not to have any user defined networks, you could simply delete the metadata for networks:

.1) stop the docker engine: sudo service docker stop
2) delete the metadata file: sudo rm $(docker info --format ‘{{.DockerRootDir}}’)/network/files/local-kv.db
3) start the docker engine again: sudo service docker start

When the docker service is started it will re-create the file with the default networks again.

OK that worked, is there some way to edit that file safely in case I make other networks and mess up and need to delete 1 network?

If you figure out what kv db type it actualy is (I would put my money on bolt db), and find a way to modify it
using the toolchain for this type of kv db… might work… might not. I have no idea :slight_smile: