mirror of https://github.com/docker/docs.git
				
				
				
			
		
			
				
	
	
		
			113 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
command: docker network prune
 | 
						||
short: Remove all unused networks
 | 
						||
long: |-
 | 
						||
    Remove all unused networks. Unused networks are those which are not referenced
 | 
						||
    by any containers.    
 | 
						||
usage: docker network prune [OPTIONS]
 | 
						||
pname: docker network
 | 
						||
plink: docker_network.yaml
 | 
						||
options:
 | 
						||
    - option: filter
 | 
						||
      value_type: filter
 | 
						||
      description: Provide filter values (e.g. `until=<timestamp>`)
 | 
						||
      details_url: '#filter'
 | 
						||
      deprecated: false
 | 
						||
      hidden: false
 | 
						||
      experimental: false
 | 
						||
      experimentalcli: false
 | 
						||
      kubernetes: false
 | 
						||
      swarm: false
 | 
						||
    - option: force
 | 
						||
      shorthand: f
 | 
						||
      value_type: bool
 | 
						||
      default_value: "false"
 | 
						||
      description: Do not prompt for confirmation
 | 
						||
      deprecated: false
 | 
						||
      hidden: false
 | 
						||
      experimental: false
 | 
						||
      experimentalcli: false
 | 
						||
      kubernetes: false
 | 
						||
      swarm: false
 | 
						||
inherited_options:
 | 
						||
    - option: help
 | 
						||
      value_type: bool
 | 
						||
      default_value: "false"
 | 
						||
      description: Print usage
 | 
						||
      deprecated: false
 | 
						||
      hidden: true
 | 
						||
      experimental: false
 | 
						||
      experimentalcli: false
 | 
						||
      kubernetes: false
 | 
						||
      swarm: false
 | 
						||
examples: |-
 | 
						||
    ```console
 | 
						||
    $ docker network prune
 | 
						||
 | 
						||
    WARNING! This will remove all custom networks not used by at least one container.
 | 
						||
    Are you sure you want to continue? [y/N] y
 | 
						||
    Deleted Networks:
 | 
						||
    n1
 | 
						||
    n2
 | 
						||
    ```
 | 
						||
 | 
						||
    ### Filtering (--filter) {#filter}
 | 
						||
 | 
						||
    The filtering flag (`--filter`) format is of "key=value". If there is more
 | 
						||
    than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
 | 
						||
 | 
						||
    The currently supported filters are:
 | 
						||
 | 
						||
    * until (`<timestamp>`) - only remove networks created before given timestamp
 | 
						||
    * label (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) - only remove networks with (or without, in case `label!=...` is used) the specified labels.
 | 
						||
 | 
						||
    The `until` filter can be Unix timestamps, date formatted
 | 
						||
    timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed
 | 
						||
    relative to the daemon machine’s time. Supported formats for date
 | 
						||
    formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`,
 | 
						||
    `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
 | 
						||
    timezone on the daemon will be used if you do not provide either a `Z` or a
 | 
						||
    `+-00:00` timezone offset at the end of the timestamp.  When providing Unix
 | 
						||
    timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
 | 
						||
    that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
 | 
						||
    seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
 | 
						||
    fraction of a second no more than nine digits long.
 | 
						||
 | 
						||
    The `label` filter accepts two formats. One is the `label=...` (`label=<key>` or `label=<key>=<value>`),
 | 
						||
    which removes networks with the specified labels. The other
 | 
						||
    format is the `label!=...` (`label!=<key>` or `label!=<key>=<value>`), which removes
 | 
						||
    networks without the specified labels.
 | 
						||
 | 
						||
    The following removes networks created more than 5 minutes ago. Note that
 | 
						||
    system networks such as `bridge`, `host`, and `none` will never be pruned:
 | 
						||
 | 
						||
    ```console
 | 
						||
    $ docker network ls
 | 
						||
 | 
						||
    NETWORK ID          NAME                DRIVER              SCOPE
 | 
						||
    7430df902d7a        bridge              bridge              local
 | 
						||
    ea92373fd499        foo-1-day-ago       bridge              local
 | 
						||
    ab53663ed3c7        foo-1-min-ago       bridge              local
 | 
						||
    97b91972bc3b        host                host                local
 | 
						||
    f949d337b1f5        none                null                local
 | 
						||
 | 
						||
    $ docker network prune --force --filter until=5m
 | 
						||
 | 
						||
    Deleted Networks:
 | 
						||
    foo-1-day-ago
 | 
						||
 | 
						||
    $ docker network ls
 | 
						||
 | 
						||
    NETWORK ID          NAME                DRIVER              SCOPE
 | 
						||
    7430df902d7a        bridge              bridge              local
 | 
						||
    ab53663ed3c7        foo-1-min-ago       bridge              local
 | 
						||
    97b91972bc3b        host                host                local
 | 
						||
    f949d337b1f5        none                null                local
 | 
						||
    ```    
 | 
						||
deprecated: false
 | 
						||
min_api_version: "1.25"
 | 
						||
experimental: false
 | 
						||
experimentalcli: false
 | 
						||
kubernetes: false
 | 
						||
swarm: false
 | 
						||
 |