소스 검색

Merge pull request #38810 from thaJeztah/network_dangling_docs

docs follow-ups for networks "dangling" filter
Sebastiaan van Stijn 6 년 전
부모
커밋
5c152ea10f
3개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 0
      api/swagger.yaml
  2. 3 3
      api/types/network/network.go
  3. 4 0
      docs/api/version-history.md

+ 4 - 0
api/swagger.yaml

@@ -8088,6 +8088,10 @@ paths:
           description: |
           description: |
             JSON encoded value of the filters (a `map[string][]string`) to process on the networks list. Available filters:
             JSON encoded value of the filters (a `map[string][]string`) to process on the networks list. Available filters:
 
 
+            - `dangling=<boolean>` When set to `true` (or `1`), returns all
+               networks that are not in use by a container. When set to `false`
+               (or `0`), only networks that are in use by one or more
+               containers are returned.
             - `driver=<driver-name>` Matches a network's driver.
             - `driver=<driver-name>` Matches a network's driver.
             - `id=<network-id>` Matches all or part of a network ID.
             - `id=<network-id>` Matches all or part of a network ID.
             - `label=<key>` or `label=<key>=<value>` of a network label.
             - `label=<key>` or `label=<key>=<value>` of a network label.

+ 3 - 3
api/types/network/network.go

@@ -112,13 +112,13 @@ type ConfigReference struct {
 }
 }
 
 
 var acceptedFilters = map[string]bool{
 var acceptedFilters = map[string]bool{
+	"dangling": true,
 	"driver":   true,
 	"driver":   true,
-	"type":     true,
-	"name":     true,
 	"id":       true,
 	"id":       true,
 	"label":    true,
 	"label":    true,
+	"name":     true,
 	"scope":    true,
 	"scope":    true,
-	"dangling": true,
+	"type":     true,
 }
 }
 
 
 // ValidateFilters validates the list of filter args with the available filters.
 // ValidateFilters validates the list of filter args with the available filters.

+ 4 - 0
docs/api/version-history.md

@@ -35,6 +35,10 @@ keywords: "API, Docker, rcli, REST, documentation"
 * `POST /services/{id}/update` now includes `Runtime` as an option in `ContainerSpec.Configs`
 * `POST /services/{id}/update` now includes `Runtime` as an option in `ContainerSpec.Configs`
 * `GET /tasks` now  returns `Sysctls` as part of the `ContainerSpec`.
 * `GET /tasks` now  returns `Sysctls` as part of the `ContainerSpec`.
 * `GET /tasks/{id}` now  returns `Sysctls` as part of the `ContainerSpec`.
 * `GET /tasks/{id}` now  returns `Sysctls` as part of the `ContainerSpec`.
+* `GET /networks` now supports a `dangling` filter type. When set to `true` (or
+  `1`), the endpoint returns all networks that are not in use by a container. When
+  set to `false` (or `0`), only networks that are in use by one or more containers
+  are returned.
 * `GET /nodes` now supports a filter type `node.label` filter to filter nodes based
 * `GET /nodes` now supports a filter type `node.label` filter to filter nodes based
   on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
   on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
   to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`
   to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`