2015-09-28 18:57:03 -07:00
|
|
|
# network rm
|
|
|
|
|
2023-01-06 19:04:05 +01:00
|
|
|
<!---MARKER_GEN_START-->
|
2016-07-30 01:41:52 +08:00
|
|
|
Remove one or more networks
|
2015-09-28 18:57:03 -07:00
|
|
|
|
2023-01-06 19:04:05 +01:00
|
|
|
### Aliases
|
|
|
|
|
|
|
|
`docker network rm`, `docker network remove`
|
|
|
|
|
|
|
|
### Options
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
|:----------------|:-----|:--------|:-------------------------------------------|
|
|
|
|
| `-f`, `--force` | | | Do not error if the network does not exist |
|
|
|
|
|
2016-07-07 20:43:18 +02:00
|
|
|
|
2023-01-06 19:04:05 +01:00
|
|
|
<!---MARKER_GEN_END-->
|
2015-09-28 18:57:03 -07:00
|
|
|
|
2017-02-07 15:42:48 -08:00
|
|
|
## Description
|
|
|
|
|
2015-10-30 00:10:20 +08:00
|
|
|
Removes one or more networks by name or identifier. To remove a network,
|
|
|
|
you must first disconnect any containers connected to it.
|
2017-02-07 15:42:48 -08:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Remove a network
|
|
|
|
|
2015-10-30 00:10:20 +08:00
|
|
|
To remove the network named 'my-network':
|
2015-09-28 18:57:03 -07:00
|
|
|
|
2021-08-21 14:54:14 +02:00
|
|
|
```console
|
|
|
|
$ docker network rm my-network
|
2015-09-28 18:57:03 -07:00
|
|
|
```
|
2015-10-18 16:47:32 -07:00
|
|
|
|
2017-02-07 15:42:48 -08:00
|
|
|
### Remove multiple networks
|
|
|
|
|
2015-10-30 00:10:20 +08:00
|
|
|
To delete multiple networks in a single `docker network rm` command, provide
|
2016-02-17 11:54:45 +08:00
|
|
|
multiple network names or ids. The following example deletes a network with id
|
2015-10-30 00:10:20 +08:00
|
|
|
`3695c422697f` and a network named `my-network`:
|
|
|
|
|
2021-08-21 14:54:14 +02:00
|
|
|
```console
|
|
|
|
$ docker network rm 3695c422697f my-network
|
2015-10-30 00:10:20 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
When you specify multiple networks, the command attempts to delete each in turn.
|
|
|
|
If the deletion of one network fails, the command continues to the next on the
|
|
|
|
list and tries to delete that. The command reports success or failure for each
|
|
|
|
deletion.
|
|
|
|
|
2017-02-07 15:42:48 -08:00
|
|
|
## Related commands
|
2015-10-18 16:47:32 -07:00
|
|
|
|
|
|
|
* [network disconnect ](network_disconnect.md)
|
|
|
|
* [network connect](network_connect.md)
|
|
|
|
* [network create](network_create.md)
|
|
|
|
* [network ls](network_ls.md)
|
|
|
|
* [network inspect](network_inspect.md)
|
2016-10-18 04:36:52 +00:00
|
|
|
* [network prune](network_prune.md)
|
2020-04-19 15:43:08 +02:00
|
|
|
* [Understand Docker container networks](https://docs.docker.com/network/)
|