Browse code

Merge pull request #31134 from thaJeztah/update-swagger

[1.13.x] swagger cherry-picks

Sebastiaan van Stijn authored on 2017/02/18 15:26:43
Showing 8 changed files
... ...
@@ -65,7 +65,8 @@ func (sr *swarmRouter) updateCluster(ctx context.Context, w http.ResponseWriter,
65 65
 	rawVersion := r.URL.Query().Get("version")
66 66
 	version, err := strconv.ParseUint(rawVersion, 10, 64)
67 67
 	if err != nil {
68
-		return fmt.Errorf("Invalid swarm version '%s': %s", rawVersion, err.Error())
68
+		err := fmt.Errorf("invalid swarm version '%s': %v", rawVersion, err)
69
+		return errors.NewBadRequestError(err)
69 70
 	}
70 71
 
71 72
 	var flags types.UpdateFlags
... ...
@@ -73,7 +74,8 @@ func (sr *swarmRouter) updateCluster(ctx context.Context, w http.ResponseWriter,
73 73
 	if value := r.URL.Query().Get("rotateWorkerToken"); value != "" {
74 74
 		rot, err := strconv.ParseBool(value)
75 75
 		if err != nil {
76
-			return fmt.Errorf("invalid value for rotateWorkerToken: %s", value)
76
+			err := fmt.Errorf("invalid value for rotateWorkerToken: %s", value)
77
+			return errors.NewBadRequestError(err)
77 78
 		}
78 79
 
79 80
 		flags.RotateWorkerToken = rot
... ...
@@ -82,7 +84,8 @@ func (sr *swarmRouter) updateCluster(ctx context.Context, w http.ResponseWriter,
82 82
 	if value := r.URL.Query().Get("rotateManagerToken"); value != "" {
83 83
 		rot, err := strconv.ParseBool(value)
84 84
 		if err != nil {
85
-			return fmt.Errorf("invalid value for rotateManagerToken: %s", value)
85
+			err := fmt.Errorf("invalid value for rotateManagerToken: %s", value)
86
+			return errors.NewBadRequestError(err)
86 87
 		}
87 88
 
88 89
 		flags.RotateManagerToken = rot
... ...
@@ -91,7 +94,7 @@ func (sr *swarmRouter) updateCluster(ctx context.Context, w http.ResponseWriter,
91 91
 	if value := r.URL.Query().Get("rotateManagerUnlockKey"); value != "" {
92 92
 		rot, err := strconv.ParseBool(value)
93 93
 		if err != nil {
94
-			return fmt.Errorf("invalid value for rotateManagerUnlockKey: %s", value)
94
+			return errors.NewBadRequestError(fmt.Errorf("invalid value for rotateManagerUnlockKey: %s", value))
95 95
 		}
96 96
 
97 97
 		flags.RotateManagerUnlockKey = rot
... ...
@@ -184,7 +187,8 @@ func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter,
184 184
 	rawVersion := r.URL.Query().Get("version")
185 185
 	version, err := strconv.ParseUint(rawVersion, 10, 64)
186 186
 	if err != nil {
187
-		return fmt.Errorf("Invalid service version '%s': %s", rawVersion, err.Error())
187
+		err := fmt.Errorf("invalid service version '%s': %v", rawVersion, err)
188
+		return errors.NewBadRequestError(err)
188 189
 	}
189 190
 
190 191
 	// Get returns "" if the header does not exist
... ...
@@ -294,7 +298,8 @@ func (sr *swarmRouter) updateNode(ctx context.Context, w http.ResponseWriter, r
294 294
 	rawVersion := r.URL.Query().Get("version")
295 295
 	version, err := strconv.ParseUint(rawVersion, 10, 64)
296 296
 	if err != nil {
297
-		return fmt.Errorf("Invalid node version '%s': %s", rawVersion, err.Error())
297
+		err := fmt.Errorf("invalid node version '%s': %v", rawVersion, err)
298
+		return errors.NewBadRequestError(err)
298 299
 	}
299 300
 
300 301
 	if err := sr.backend.UpdateNode(vars["id"], version, node); err != nil {
... ...
@@ -1066,6 +1066,8 @@ definitions:
1066 1066
         $ref: "#/definitions/IPAM"
1067 1067
       Internal:
1068 1068
         type: "boolean"
1069
+      Attachable:
1070
+        type: "boolean"
1069 1071
       Containers:
1070 1072
         type: "object"
1071 1073
         additionalProperties:
... ...
@@ -1093,6 +1095,7 @@ definitions:
1093 1093
         Options:
1094 1094
           foo: "bar"
1095 1095
       Internal: false
1096
+      Attachable: false
1096 1097
       Containers:
1097 1098
         19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c:
1098 1099
           Name: "test"
... ...
@@ -2453,22 +2456,21 @@ paths:
2453 2453
         - name: "filters"
2454 2454
           in: "query"
2455 2455
           description: |
2456
-            Filters to process on the container list, encoded as JSON (a `map[string][]string`). For example, `{"status": ["paused"]}` will only return paused containers.
2456
+            Filters to process on the container list, encoded as JSON (a `map[string][]string`). For example, `{"status": ["paused"]}` will only return paused containers. Available filters:
2457 2457
 
2458
-            Available filters:
2458
+            - `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`)
2459
+            - `before`=(`<container id>` or `<container name>`)
2459 2460
             - `exited=<int>` containers with exit code of `<int>`
2460
-            - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`)
2461
-            - `label=key` or `label="key=value"` of a container label
2462
-            - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
2461
+            - `health`=(`starting`|`healthy`|`unhealthy`|`none`)
2463 2462
             - `id=<ID>` a container's ID
2464
-            - `name=<name>` a container's name
2463
+            - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
2465 2464
             - `is-task=`(`true`|`false`)
2466
-            - `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`)
2467
-            - `before`=(`<container id>` or `<container name>`)
2465
+            - `label=key` or `label="key=value"` of a container label
2466
+            - `name=<name>` a container's name
2467
+            - `network`=(`<network id>` or `<network name>`)
2468 2468
             - `since`=(`<container id>` or `<container name>`)
2469
+            - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`)
2469 2470
             - `volume`=(`<volume name>` or `<mount point destination>`)
2470
-            - `network`=(`<network id>` or `<network name>`)
2471
-            - `health`=(`starting`|`healthy`|`unhealthy`|`none`)
2472 2471
           type: "string"
2473 2472
       responses:
2474 2473
         200:
... ...
@@ -4014,6 +4016,13 @@ paths:
4014 4014
           examples:
4015 4015
             application/json:
4016 4016
               message: "No such container: c2ada9df5af8"
4017
+        409:
4018
+          description: "conflict"
4019
+          schema:
4020
+            $ref: "#/definitions/ErrorResponse"
4021
+          examples:
4022
+            application/json:
4023
+              message: "You cannot remove a running container: c2ada9df5af8. Stop the container before attempting removal or use -f"
4017 4024
         500:
4018 4025
           description: "server error"
4019 4026
           schema:
... ...
@@ -4265,14 +4274,13 @@ paths:
4265 4265
         - name: "filters"
4266 4266
           in: "query"
4267 4267
           description: |
4268
-            A JSON encoded value of the filters (a `map[string][]string`) to process on the images list.
4268
+            A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters:
4269 4269
 
4270
-            Available filters:
4270
+            - `before`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
4271 4271
             - `dangling=true`
4272 4272
             - `label=key` or `label="key=value"` of an image label
4273
-            - `before`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
4274
-            - `since`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
4275 4273
             - `reference`=(`<image-name>[:<tag>]`)
4274
+            - `since`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
4276 4275
           type: "string"
4277 4276
         - name: "digests"
4278 4277
           in: "query"
... ...
@@ -4846,9 +4854,9 @@ paths:
4846 4846
           description: |
4847 4847
             A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters:
4848 4848
 
4849
-            - `stars=<number>`
4850 4849
             - `is-automated=(true|false)`
4851 4850
             - `is-official=(true|false)`
4851
+            - `stars=<number>` Matches images that has at least 'number' stars.
4852 4852
           type: "string"
4853 4853
       tags: ["Image"]
4854 4854
   /images/prune:
... ...
@@ -4861,9 +4869,8 @@ paths:
4861 4861
         - name: "filters"
4862 4862
           in: "query"
4863 4863
           description: |
4864
-            Filters to process on the prune list, encoded as JSON (a `map[string][]string`).
4864
+            Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters:
4865 4865
 
4866
-            Available filters:
4867 4866
             - `dangling=<boolean>` When set to `true` (or `1`), prune only
4868 4867
                unused *and* untagged images. When set to `false`
4869 4868
                (or `0`), all unused images are pruned.
... ...
@@ -5275,7 +5282,7 @@ paths:
5275 5275
 
5276 5276
         Various objects within Docker report events when something happens to them.
5277 5277
 
5278
-        Containers report these events: `attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update`
5278
+        Containers report these events: `attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, health_status, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update`
5279 5279
 
5280 5280
         Images report these events: `delete, import, load, pull, push, save, tag, untag`
5281 5281
 
... ...
@@ -5329,6 +5336,10 @@ paths:
5329 5329
                   image: "alpine"
5330 5330
                   name: "my-container"
5331 5331
               time: 1461943101
5332
+        400:
5333
+          description: "bad parameter"
5334
+          schema:
5335
+            $ref: "#/definitions/ErrorResponse"
5332 5336
         500:
5333 5337
           description: "server error"
5334 5338
           schema:
... ...
@@ -5348,13 +5359,14 @@ paths:
5348 5348
             A JSON encoded value of filters (a `map[string][]string`) to process on the event list. Available filters:
5349 5349
 
5350 5350
             - `container=<string>` container name or ID
5351
+            - `daemon=<string>` daemon name or ID
5351 5352
             - `event=<string>` event type
5352 5353
             - `image=<string>` image name or ID
5353 5354
             - `label=<string>` image or container label
5355
+            - `network=<string>` network name or ID
5356
+            - `plugin`=<string> plugin name or ID
5354 5357
             - `type=<string>` object to filter by, one of `container`, `image`, `volume`, `network`, or `daemon`
5355 5358
             - `volume=<string>` volume name or ID
5356
-            - `network=<string>` network name or ID
5357
-            - `daemon=<string>` daemon name or ID
5358 5359
           type: "string"
5359 5360
       tags: ["System"]
5360 5361
   /system/df:
... ...
@@ -5828,13 +5840,14 @@ paths:
5828 5828
             JSON encoded value of the filters (a `map[string][]string`) to
5829 5829
             process on the volumes list. Available filters:
5830 5830
 
5831
-            - `name=<volume-name>` Matches all or part of a volume name.
5832 5831
             - `dangling=<boolean>` When set to `true` (or `1`), returns all
5833 5832
                volumes that are not in use by a container. When set to `false`
5834 5833
                (or `0`), only volumes that are in use by one or more
5835 5834
                containers are returned.
5836
-            - `driver=<volume-driver-name>` Matches all or part of a volume
5837
-              driver name.
5835
+            - `driver=<volume-driver-name>` Matches volumes based on their driver.
5836
+            - `label=<key>` or `label=<key>:<value>` Matches volumes based on
5837
+               the presence of a `label` alone or a `label` and a value.
5838
+            - `name=<volume-name>` Matches all or part of a volume name.
5838 5839
           type: "string"
5839 5840
           format: "json"
5840 5841
       tags: ["Volume"]
... ...
@@ -6002,6 +6015,7 @@ paths:
6002 6002
                 Driver: "bridge"
6003 6003
                 EnableIPv6: false
6004 6004
                 Internal: false
6005
+                Attachable: false
6005 6006
                 IPAM:
6006 6007
                   Driver: "default"
6007 6008
                   Config:
... ...
@@ -6027,6 +6041,7 @@ paths:
6027 6027
                 Driver: "null"
6028 6028
                 EnableIPv6: false
6029 6029
                 Internal: false
6030
+                Attachable: false
6030 6031
                 IPAM:
6031 6032
                   Driver: "default"
6032 6033
                   Config: []
... ...
@@ -6039,6 +6054,7 @@ paths:
6039 6039
                 Driver: "host"
6040 6040
                 EnableIPv6: false
6041 6041
                 Internal: false
6042
+                Attachable: false
6042 6043
                 IPAM:
6043 6044
                   Driver: "default"
6044 6045
                   Config: []
... ...
@@ -6163,6 +6179,9 @@ paths:
6163 6163
               Internal:
6164 6164
                 description: "Restrict external access to the network."
6165 6165
                 type: "boolean"
6166
+              Attachable:
6167
+                description: "Globally scoped network is manually attachable by regular containers from workers in swarm mode."
6168
+                type: "boolean"
6166 6169
               IPAM:
6167 6170
                 description: "Optional custom IP scheme for the network."
6168 6171
                 $ref: "#/definitions/IPAM"
... ...
@@ -6195,6 +6214,7 @@ paths:
6195 6195
                 Options:
6196 6196
                   foo: "bar"
6197 6197
               Internal: true
6198
+              Attachable: false
6198 6199
               Options:
6199 6200
                 com.docker.network.bridge.default_bridge: "true"
6200 6201
                 com.docker.network.bridge.enable_icc: "true"
... ...
@@ -6557,6 +6577,10 @@ paths:
6557 6557
       responses:
6558 6558
         200:
6559 6559
           description: "no error"
6560
+        404:
6561
+          description: "plugin is not installed"
6562
+          schema:
6563
+            $ref: "#/definitions/ErrorResponse"
6560 6564
         500:
6561 6565
           description: "server error"
6562 6566
           schema:
... ...
@@ -6580,6 +6604,10 @@ paths:
6580 6580
       responses:
6581 6581
         200:
6582 6582
           description: "no error"
6583
+        404:
6584
+          description: "plugin is not installed"
6585
+          schema:
6586
+            $ref: "#/definitions/ErrorResponse"
6583 6587
         500:
6584 6588
           description: "server error"
6585 6589
           schema:
... ...
@@ -6746,10 +6774,22 @@ paths:
6746 6746
             type: "array"
6747 6747
             items:
6748 6748
               $ref: "#/definitions/Node"
6749
+        400:
6750
+          description: "bad parameter"
6751
+          schema:
6752
+            $ref: "#/definitions/ErrorResponse"
6753
+        404:
6754
+          description: "no such node"
6755
+          schema:
6756
+            $ref: "#/definitions/ErrorResponse"
6749 6757
         500:
6750 6758
           description: "server error"
6751 6759
           schema:
6752 6760
             $ref: "#/definitions/ErrorResponse"
6761
+        503:
6762
+          description: "node is not part of a swarm"
6763
+          schema:
6764
+            $ref: "#/definitions/ErrorResponse"
6753 6765
       parameters:
6754 6766
         - name: "filters"
6755 6767
           in: "query"
... ...
@@ -6781,6 +6821,10 @@ paths:
6781 6781
           description: "server error"
6782 6782
           schema:
6783 6783
             $ref: "#/definitions/ErrorResponse"
6784
+        503:
6785
+          description: "node is not part of a swarm"
6786
+          schema:
6787
+            $ref: "#/definitions/ErrorResponse"
6784 6788
       parameters:
6785 6789
         - name: "id"
6786 6790
           in: "path"
... ...
@@ -6802,6 +6846,10 @@ paths:
6802 6802
           description: "server error"
6803 6803
           schema:
6804 6804
             $ref: "#/definitions/ErrorResponse"
6805
+        503:
6806
+          description: "node is not part of a swarm"
6807
+          schema:
6808
+            $ref: "#/definitions/ErrorResponse"
6805 6809
       parameters:
6806 6810
         - name: "id"
6807 6811
           in: "path"
... ...
@@ -6829,6 +6877,10 @@ paths:
6829 6829
           description: "server error"
6830 6830
           schema:
6831 6831
             $ref: "#/definitions/ErrorResponse"
6832
+        503:
6833
+          description: "node is not part of a swarm"
6834
+          schema:
6835
+            $ref: "#/definitions/ErrorResponse"
6832 6836
       parameters:
6833 6837
         - name: "id"
6834 6838
           in: "path"
... ...
@@ -6893,10 +6945,18 @@ paths:
6893 6893
               UpdatedAt: "2016-08-15T16:32:09.623207604Z"
6894 6894
               Version:
6895 6895
                 Index: 51
6896
+        404:
6897
+          description: "no such swarm"
6898
+          schema:
6899
+            $ref: "#/definitions/ErrorResponse"
6896 6900
         500:
6897 6901
           description: "server error"
6898 6902
           schema:
6899 6903
             $ref: "#/definitions/ErrorResponse"
6904
+        503:
6905
+          description: "node is not part of a swarm"
6906
+          schema:
6907
+            $ref: "#/definitions/ErrorResponse"
6900 6908
       tags: ["Swarm"]
6901 6909
   /swarm/init:
6902 6910
     post:
... ...
@@ -6916,14 +6976,14 @@ paths:
6916 6916
           description: "bad parameter"
6917 6917
           schema:
6918 6918
             $ref: "#/definitions/ErrorResponse"
6919
-        406:
6920
-          description: "node is already part of a swarm"
6921
-          schema:
6922
-            $ref: "#/definitions/ErrorResponse"
6923 6919
         500:
6924 6920
           description: "server error"
6925 6921
           schema:
6926 6922
             $ref: "#/definitions/ErrorResponse"
6923
+        503:
6924
+          description: "node is already part of a swarm"
6925
+          schema:
6926
+            $ref: "#/definitions/ErrorResponse"
6927 6927
       parameters:
6928 6928
         - name: "body"
6929 6929
           in: "body"
... ...
@@ -7089,6 +7149,10 @@ paths:
7089 7089
           description: "server error"
7090 7090
           schema:
7091 7091
             $ref: "#/definitions/ErrorResponse"
7092
+        503:
7093
+          description: "node is not part of a swarm"
7094
+          schema:
7095
+            $ref: "#/definitions/ErrorResponse"
7092 7096
       tags: ["Swarm"]
7093 7097
   /swarm/unlock:
7094 7098
     post:
... ...
@@ -7117,6 +7181,10 @@ paths:
7117 7117
           description: "server error"
7118 7118
           schema:
7119 7119
             $ref: "#/definitions/ErrorResponse"
7120
+        503:
7121
+          description: "node is not part of a swarm"
7122
+          schema:
7123
+            $ref: "#/definitions/ErrorResponse"
7120 7124
       tags: ["Swarm"]
7121 7125
   /services:
7122 7126
     get:
... ...
@@ -7133,6 +7201,10 @@ paths:
7133 7133
           description: "server error"
7134 7134
           schema:
7135 7135
             $ref: "#/definitions/ErrorResponse"
7136
+        503:
7137
+          description: "node is not part of a swarm"
7138
+          schema:
7139
+            $ref: "#/definitions/ErrorResponse"
7136 7140
       parameters:
7137 7141
         - name: "filters"
7138 7142
           in: "query"
... ...
@@ -7141,8 +7213,8 @@ paths:
7141 7141
             A JSON encoded value of the filters (a `map[string][]string`) to process on the services list. Available filters:
7142 7142
 
7143 7143
             - `id=<service id>`
7144
-            - `name=<service name>`
7145 7144
             - `label=<service label>`
7145
+            - `name=<service name>`
7146 7146
       tags: ["Service"]
7147 7147
   /services/create:
7148 7148
     post:
... ...
@@ -7167,6 +7239,10 @@ paths:
7167 7167
             example:
7168 7168
               ID: "ak7w3gjqoa3kuz8xcpnyy0pvl"
7169 7169
               Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
7170
+        400:
7171
+          description: "bad parameter"
7172
+          schema:
7173
+            $ref: "#/definitions/ErrorResponse"
7170 7174
         403:
7171 7175
           description: "network is not eligible for services"
7172 7176
           schema:
... ...
@@ -7180,7 +7256,7 @@ paths:
7180 7180
           schema:
7181 7181
             $ref: "#/definitions/ErrorResponse"
7182 7182
         503:
7183
-          description: "server error or node is not part of a swarm"
7183
+          description: "node is not part of a swarm"
7184 7184
           schema:
7185 7185
             $ref: "#/definitions/ErrorResponse"
7186 7186
       parameters:
... ...
@@ -7262,6 +7338,10 @@ paths:
7262 7262
           description: "server error"
7263 7263
           schema:
7264 7264
             $ref: "#/definitions/ErrorResponse"
7265
+        503:
7266
+          description: "node is not part of a swarm"
7267
+          schema:
7268
+            $ref: "#/definitions/ErrorResponse"
7265 7269
       parameters:
7266 7270
         - name: "id"
7267 7271
           in: "path"
... ...
@@ -7283,6 +7363,10 @@ paths:
7283 7283
           description: "server error"
7284 7284
           schema:
7285 7285
             $ref: "#/definitions/ErrorResponse"
7286
+        503:
7287
+          description: "node is not part of a swarm"
7288
+          schema:
7289
+            $ref: "#/definitions/ErrorResponse"
7286 7290
       parameters:
7287 7291
         - name: "id"
7288 7292
           in: "path"
... ...
@@ -7301,6 +7385,10 @@ paths:
7301 7301
           description: "no error"
7302 7302
           schema:
7303 7303
             $ref: "#/definitions/ImageDeleteResponse"
7304
+        400:
7305
+          description: "bad parameter"
7306
+          schema:
7307
+            $ref: "#/definitions/ErrorResponse"
7304 7308
         404:
7305 7309
           description: "no such service"
7306 7310
           schema:
... ...
@@ -7309,6 +7397,10 @@ paths:
7309 7309
           description: "server error"
7310 7310
           schema:
7311 7311
             $ref: "#/definitions/ErrorResponse"
7312
+        503:
7313
+          description: "node is not part of a swarm"
7314
+          schema:
7315
+            $ref: "#/definitions/ErrorResponse"
7312 7316
       parameters:
7313 7317
         - name: "id"
7314 7318
           in: "path"
... ...
@@ -7397,6 +7489,10 @@ paths:
7397 7397
           description: "server error"
7398 7398
           schema:
7399 7399
             $ref: "#/definitions/ErrorResponse"
7400
+        503:
7401
+          description: "node is not part of a swarm"
7402
+          schema:
7403
+            $ref: "#/definitions/ErrorResponse"
7400 7404
       parameters:
7401 7405
         - name: "id"
7402 7406
           in: "path"
... ...
@@ -7566,11 +7662,14 @@ paths:
7566 7566
                             Gateway: "10.255.0.1"
7567 7567
                     Addresses:
7568 7568
                       - "10.255.0.5/16"
7569
-
7570 7569
         500:
7571 7570
           description: "server error"
7572 7571
           schema:
7573 7572
             $ref: "#/definitions/ErrorResponse"
7573
+        503:
7574
+          description: "node is not part of a swarm"
7575
+          schema:
7576
+            $ref: "#/definitions/ErrorResponse"
7574 7577
       parameters:
7575 7578
         - name: "filters"
7576 7579
           in: "query"
... ...
@@ -7578,12 +7677,12 @@ paths:
7578 7578
           description: |
7579 7579
             A JSON encoded value of the filters (a `map[string][]string`) to process on the tasks list. Available filters:
7580 7580
 
7581
+            - `desired-state=(running | shutdown | accepted)`
7581 7582
             - `id=<task id>`
7583
+            - `label=key` or `label="key=value"`
7582 7584
             - `name=<task name>`
7583
-            - `service=<service name>`
7584 7585
             - `node=<node id or name>`
7585
-            - `label=key` or `label="key=value"`
7586
-            - `desired-state=(running | shutdown | accepted)`
7586
+            - `service=<service name>`
7587 7587
       tags: ["Task"]
7588 7588
   /tasks/{id}:
7589 7589
     get:
... ...
@@ -7604,6 +7703,10 @@ paths:
7604 7604
           description: "server error"
7605 7605
           schema:
7606 7606
             $ref: "#/definitions/ErrorResponse"
7607
+        503:
7608
+          description: "node is not part of a swarm"
7609
+          schema:
7610
+            $ref: "#/definitions/ErrorResponse"
7607 7611
       parameters:
7608 7612
         - name: "id"
7609 7613
           in: "path"
... ...
@@ -7636,6 +7739,10 @@ paths:
7636 7636
           description: "server error"
7637 7637
           schema:
7638 7638
             $ref: "#/definitions/ErrorResponse"
7639
+        503:
7640
+          description: "node is not part of a swarm"
7641
+          schema:
7642
+            $ref: "#/definitions/ErrorResponse"
7639 7643
       parameters:
7640 7644
         - name: "filters"
7641 7645
           in: "query"
... ...
@@ -7664,10 +7771,6 @@ paths:
7664 7664
                 type: "string"
7665 7665
             example:
7666 7666
               ID: "ktnbjxoalbkvbvedmg1urrz8h"
7667
-        406:
7668
-          description: "server error or node is not part of a swarm"
7669
-          schema:
7670
-            $ref: "#/definitions/ErrorResponse"
7671 7667
         409:
7672 7668
           description: "name conflicts with an existing object"
7673 7669
           schema:
... ...
@@ -7676,6 +7779,10 @@ paths:
7676 7676
           description: "server error"
7677 7677
           schema:
7678 7678
             $ref: "#/definitions/ErrorResponse"
7679
+        503:
7680
+          description: "node is not part of a swarm"
7681
+          schema:
7682
+            $ref: "#/definitions/ErrorResponse"
7679 7683
       parameters:
7680 7684
         - name: "body"
7681 7685
           in: "body"
... ...
@@ -7712,14 +7819,14 @@ paths:
7712 7712
           description: "secret not found"
7713 7713
           schema:
7714 7714
             $ref: "#/definitions/ErrorResponse"
7715
-        406:
7716
-          description: "node is not part of a swarm"
7717
-          schema:
7718
-            $ref: "#/definitions/ErrorResponse"
7719 7715
         500:
7720 7716
           description: "server error"
7721 7717
           schema:
7722 7718
             $ref: "#/definitions/ErrorResponse"
7719
+        503:
7720
+          description: "node is not part of a swarm"
7721
+          schema:
7722
+            $ref: "#/definitions/ErrorResponse"
7723 7723
       parameters:
7724 7724
         - name: "id"
7725 7725
           in: "path"
... ...
@@ -7743,6 +7850,10 @@ paths:
7743 7743
           description: "server error"
7744 7744
           schema:
7745 7745
             $ref: "#/definitions/ErrorResponse"
7746
+        503:
7747
+          description: "node is not part of a swarm"
7748
+          schema:
7749
+            $ref: "#/definitions/ErrorResponse"
7746 7750
       parameters:
7747 7751
         - name: "id"
7748 7752
           in: "path"
... ...
@@ -419,7 +419,7 @@ func (c *Cluster) Init(req types.InitRequest) (string, error) {
419 419
 
420 420
 	if err := validateAndSanitizeInitRequest(&req); err != nil {
421 421
 		c.Unlock()
422
-		return "", err
422
+		return "", apierrors.NewBadRequestError(err)
423 423
 	}
424 424
 
425 425
 	listenHost, listenPort, err := resolveListenAddr(req.ListenAddr)
... ...
@@ -506,7 +506,7 @@ func (c *Cluster) Join(req types.JoinRequest) error {
506 506
 	}
507 507
 	if err := validateAndSanitizeJoinRequest(&req); err != nil {
508 508
 		c.Unlock()
509
-		return err
509
+		return apierrors.NewBadRequestError(err)
510 510
 	}
511 511
 
512 512
 	listenHost, listenPort, err := resolveListenAddr(req.ListenAddr)
... ...
@@ -803,7 +803,7 @@ func (c *Cluster) Update(version uint64, spec types.Spec, flags types.UpdateFlag
803 803
 	// will be used to swarmkit.
804 804
 	clusterSpec, err := convert.SwarmSpecToGRPC(spec)
805 805
 	if err != nil {
806
-		return err
806
+		return apierrors.NewBadRequestError(err)
807 807
 	}
808 808
 
809 809
 	_, err = c.client.UpdateCluster(
... ...
@@ -1085,7 +1085,7 @@ func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string) (*apity
1085 1085
 
1086 1086
 	serviceSpec, err := convert.ServiceSpecToGRPC(s)
1087 1087
 	if err != nil {
1088
-		return nil, err
1088
+		return nil, apierrors.NewBadRequestError(err)
1089 1089
 	}
1090 1090
 
1091 1091
 	ctnr := serviceSpec.Task.GetContainer()
... ...
@@ -1168,7 +1168,7 @@ func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec typ
1168 1168
 
1169 1169
 	serviceSpec, err := convert.ServiceSpecToGRPC(spec)
1170 1170
 	if err != nil {
1171
-		return nil, err
1171
+		return nil, apierrors.NewBadRequestError(err)
1172 1172
 	}
1173 1173
 
1174 1174
 	currentService, err := getService(ctx, c.client, serviceIDOrName)
... ...
@@ -1383,7 +1383,7 @@ func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, erro
1383 1383
 	return nodes, nil
1384 1384
 }
1385 1385
 
1386
-// GetNode returns a node based on an ID or name.
1386
+// GetNode returns a node based on an ID.
1387 1387
 func (c *Cluster) GetNode(input string) (types.Node, error) {
1388 1388
 	c.RLock()
1389 1389
 	defer c.RUnlock()
... ...
@@ -1413,7 +1413,7 @@ func (c *Cluster) UpdateNode(input string, version uint64, spec types.NodeSpec)
1413 1413
 
1414 1414
 	nodeSpec, err := convert.NodeSpecToGRPC(spec)
1415 1415
 	if err != nil {
1416
-		return err
1416
+		return apierrors.NewBadRequestError(err)
1417 1417
 	}
1418 1418
 
1419 1419
 	ctx, cancel := c.getRequestContext()
... ...
@@ -3,6 +3,7 @@ package cluster
3 3
 import (
4 4
 	"fmt"
5 5
 
6
+	"github.com/docker/docker/api/errors"
6 7
 	swarmapi "github.com/docker/swarmkit/api"
7 8
 	"golang.org/x/net/context"
8 9
 )
... ...
@@ -14,7 +15,7 @@ func getSwarm(ctx context.Context, c swarmapi.ControlClient) (*swarmapi.Cluster,
14 14
 	}
15 15
 
16 16
 	if len(rl.Clusters) == 0 {
17
-		return nil, fmt.Errorf("swarm not found")
17
+		return nil, errors.NewRequestNotFoundError(ErrNoSwarm)
18 18
 	}
19 19
 
20 20
 	// TODO: assume one cluster only
... ...
@@ -38,7 +39,8 @@ func getNode(ctx context.Context, c swarmapi.ControlClient, input string) (*swar
38 38
 		}
39 39
 
40 40
 		if len(rl.Nodes) == 0 {
41
-			return nil, fmt.Errorf("node %s not found", input)
41
+			err := fmt.Errorf("node %s not found", input)
42
+			return nil, errors.NewRequestNotFoundError(err)
42 43
 		}
43 44
 
44 45
 		if l := len(rl.Nodes); l > 1 {
... ...
@@ -66,7 +68,8 @@ func getService(ctx context.Context, c swarmapi.ControlClient, input string) (*s
66 66
 		}
67 67
 
68 68
 		if len(rl.Services) == 0 {
69
-			return nil, fmt.Errorf("service %s not found", input)
69
+			err := fmt.Errorf("service %s not found", input)
70
+			return nil, errors.NewRequestNotFoundError(err)
70 71
 		}
71 72
 
72 73
 		if l := len(rl.Services); l > 1 {
... ...
@@ -95,7 +98,8 @@ func getTask(ctx context.Context, c swarmapi.ControlClient, input string) (*swar
95 95
 		}
96 96
 
97 97
 		if len(rl.Tasks) == 0 {
98
-			return nil, fmt.Errorf("task %s not found", input)
98
+			err := fmt.Errorf("task %s not found", input)
99
+			return nil, errors.NewRequestNotFoundError(err)
99 100
 		}
100 101
 
101 102
 		if l := len(rl.Tasks); l > 1 {
... ...
@@ -2632,6 +2632,7 @@ Docker daemon report the following event:
2632 2632
 **Status codes**:
2633 2633
 
2634 2634
 -   **200** – no error
2635
+-   **400** - bad parameter
2635 2636
 -   **500** – server error
2636 2637
 
2637 2638
 #### Get a tarball containing all images in a repository
... ...
@@ -3784,6 +3785,7 @@ Content-Type: text/plain; charset=utf-8
3784 3784
 **Status codes**:
3785 3785
 
3786 3786
 -   **200** - no error
3787
+-   **404** - plugin not installed
3787 3788
 -   **500** - plugin is already enabled
3788 3789
 
3789 3790
 #### Disable a plugin
... ...
@@ -3812,6 +3814,7 @@ Content-Type: text/plain; charset=utf-8
3812 3812
 **Status codes**:
3813 3813
 
3814 3814
 -   **200** - no error
3815
+-   **404** - plugin not installed
3815 3816
 -   **500** - plugin is already disabled
3816 3817
 
3817 3818
 #### Remove a plugin
... ...
@@ -48,7 +48,7 @@ Docker networks report the following events:
48 48
 
49 49
     create, connect, disconnect, destroy
50 50
 
51
-Docker daemon report the following events:
51
+Docker daemon reports the following events:
52 52
 
53 53
     reload
54 54
 
... ...
@@ -82,14 +82,14 @@ container container 588a23dac085 *AND* the event type is *start*
82 82
 The currently supported filters are:
83 83
 
84 84
 * container (`container=<name or id>`)
85
+* daemon (`daemon=<name or id>`)
85 86
 * event (`event=<event action>`)
86 87
 * image (`image=<tag or id>`)
87
-* plugin (experimental) (`plugin=<name or id>`)
88 88
 * label (`label=<key>` or `label=<key>=<value>`)
89
+* network (`network=<name or id>`)
90
+* plugin (`plugin=<name or id>`)
89 91
 * type (`type=<container or image or volume or network or daemon>`)
90 92
 * volume (`volume=<name or id>`)
91
-* network (`network=<name or id>`)
92
-* daemon (`daemon=<name or id>`)
93 93
 
94 94
 ## Format
95 95
 
... ...
@@ -111,91 +111,108 @@ You'll need two shells for this example.
111 111
 
112 112
 **Shell 2: Start and Stop containers:**
113 113
 
114
-    $ docker start 4386fb97867d
115
-    $ docker stop 4386fb97867d
116
-    $ docker stop 7805c1d35632
114
+    $ docker create --name test alpine:latest top
115
+    $ docker start test
116
+    $ docker stop test
117 117
 
118 118
 **Shell 1: (Again .. now showing events):**
119 119
 
120
-    2015-05-12T11:51:30.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04)
121
-    2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
122
-    2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
123
-    2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
124
-    2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
120
+    2017-01-05T00:35:58.859401177+08:00 container create 0fdb48addc82871eb34eb23a847cfd033dedd1a0a37bef2e6d9eb3870fc7ff37 (image=alpine:latest, name=test)
121
+    2017-01-05T00:36:04.703631903+08:00 network connect e2e1f5ceda09d4300f3a846f0acfaa9a8bb0d89e775eb744c5acecd60e0529e2 (container=0fdb...ff37, name=bridge, type=bridge)
122
+    2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
123
+    2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
124
+    2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
125
+    2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
126
+    2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
125 127
 
126 128
 **Show events in the past from a specified time:**
127 129
 
128
-    $ docker events --since 1378216169
129
-    2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
130
-    2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
131
-    2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
132
-    2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
133
-
134
-    $ docker events --since '2013-09-03'
135
-    2015-05-12T11:51:30.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04)
136
-    2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
137
-    2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
138
-    2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
139
-    2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
130
+    $ docker events --since 1483283804
131
+    2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
132
+    2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
133
+    2017-01-05T00:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
134
+    2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
135
+    2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
136
+    2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
137
+    2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
138
+    2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
139
+
140
+    $ docker events --since '2017-01-05'
141
+    2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
142
+    2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
143
+    2017-01-05T00:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
144
+    2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
145
+    2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
146
+    2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
147
+    2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
148
+    2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
140 149
 
141 150
     $ docker events --since '2013-09-03T15:49:29'
142
-    2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
143
-    2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
144
-    2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
145
-    2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
151
+    2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
152
+    2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
153
+    2017-01-05T00:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
154
+    2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
155
+    2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
156
+    2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
157
+    2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
158
+    2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
146 159
 
147 160
 This example outputs all events that were generated in the last 3 minutes,
148 161
 relative to the current time on the client machine:
149 162
 
150
-    $ docker events --since '3m'
151
-    2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
152
-    2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
153
-    2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
154
-    2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
163
+    $ docker events --since '10m'
164
+    2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
165
+    2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
166
+    2017-01-05T00:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
167
+    2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
168
+    2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
169
+    2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
170
+    2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
171
+    2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
155 172
 
156 173
 **Filter events:**
157 174
 
158 175
     $ docker events --filter 'event=stop'
159
-    2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
160
-    2014-09-03T17:42:14.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
161
-
162
-    $ docker events --filter 'image=ubuntu-1:14.04'
163
-    2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04)
164
-    2014-05-10T17:42:14.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
165
-    2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
166
-
167
-    $ docker events --filter 'container=7805c1d35632'
168
-    2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
169
-    2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image= redis:2.8)
170
-
171
-    $ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d'
172
-    2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
173
-    2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
174
-    2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
175
-    2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
176
-
177
-    $ docker events --filter 'container=7805c1d35632' --filter 'event=stop'
178
-    2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
179
-
180
-    $ docker events --filter 'container=container_1' --filter 'container=container_2'
181
-    2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
182
-    2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
183
-    2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (imager=redis:2.8)
184
-    2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
176
+    2017-01-05T00:40:22.880175420+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
177
+    2017-01-05T00:41:17.888104182+08:00 container stop 2a8f...4e78 (image=alpine, name=kickass_brattain)
178
+
179
+    $ docker events --filter 'image=alpine'
180
+    2017-01-05T00:41:55.784240236+08:00 container create d9cd...4d70 (image=alpine, name=happy_meitner)
181
+    2017-01-05T00:41:55.913156783+08:00 container start d9cd...4d70 (image=alpine, name=happy_meitner)
182
+    2017-01-05T00:42:01.106875249+08:00 container kill d9cd...4d70 (image=alpine, name=happy_meitner, signal=15)
183
+    2017-01-05T00:42:11.111934041+08:00 container kill d9cd...4d70 (image=alpine, name=happy_meitner, signal=9)
184
+    2017-01-05T00:42:11.119578204+08:00 container die d9cd...4d70 (exitCode=137, image=alpine, name=happy_meitner)
185
+    2017-01-05T00:42:11.173276611+08:00 container stop d9cd...4d70 (image=alpine, name=happy_meitner)
186
+
187
+    $ docker events --filter 'container=test'
188
+    2017-01-05T00:43:00.139719934+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
189
+    2017-01-05T00:43:09.259951086+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
190
+    2017-01-05T00:43:09.270102715+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
191
+    2017-01-05T00:43:09.312556440+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
192
+
193
+    $ docker events --filter 'container=test' --filter 'container=d9cdb1525ea8'
194
+    2017-01-05T00:44:11.517071981+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
195
+    2017-01-05T00:44:17.685870901+08:00 container start d9cd...4d70 (image=alpine, name=happy_meitner)
196
+    2017-01-05T00:44:29.757658470+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=9)
197
+    2017-01-05T00:44:29.767718510+08:00 container die 0fdb...ff37 (exitCode=137, image=alpine:latest, name=test)
198
+    2017-01-05T00:44:29.815798344+08:00 container destroy 0fdb...ff37 (image=alpine:latest, name=test)
199
+
200
+    $ docker events --filter 'container=test' --filter 'event=stop'
201
+    2017-01-05T00:46:13.664099505+08:00 container stop a9d1...e130 (image=alpine, name=test)
185 202
 
186 203
     $ docker events --filter 'type=volume'
187 204
     2015-12-23T21:05:28.136212689Z volume create test-event-volume-local (driver=local)
188
-    2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, destination=/foo, driver=local, propagation=rprivate)
189
-    2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, driver=local)
205
+    2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562f...5025, destination=/foo, driver=local, propagation=rprivate)
206
+    2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562f...5025, driver=local)
190 207
     2015-12-23T21:05:28.716218405Z volume destroy test-event-volume-local (driver=local)
191 208
 
192 209
     $ docker events --filter 'type=network'
193
-    2015-12-23T21:38:24.705709133Z network create 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, type=bridge)
194
-    2015-12-23T21:38:25.119625123Z network connect 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, container=b4be644031a3d90b400f88ab3d4bdf4dc23adb250e696b6328b85441abe2c54e, type=bridge)
210
+    2015-12-23T21:38:24.705709133Z network create 8b11...2c5b (name=test-event-network-local, type=bridge)
211
+    2015-12-23T21:38:25.119625123Z network connect 8b11...2c5b (name=test-event-network-local, container=b4be...c54e, type=bridge)
195 212
 
196 213
     $ docker events --filter 'type=plugin' (experimental)
197
-    2016-07-25T17:30:14.825557616Z plugin pull ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
198
-    2016-07-25T17:30:14.888127370Z plugin enable ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
214
+    2016-07-25T17:30:14.825557616Z plugin pull ec7b...993f (name=tiborvass/sample-volume-plugin:latest)
215
+    2016-07-25T17:30:14.888127370Z plugin enable ec7b...993f (name=tiborvass/sample-volume-plugin:latest)
199 216
 
200 217
 **Format:**
201 218
 
... ...
@@ -23,17 +23,20 @@ List containers
23 23
 Options:
24 24
   -a, --all             Show all containers (default shows just running)
25 25
   -f, --filter value    Filter output based on conditions provided (default [])
26
+                        - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>)
27
+                          containers created from an image or a descendant.
28
+                        - before=(<container-name>|<container-id>)
26 29
                         - exited=<int> an exit code of <int>
30
+                        - health=(starting|healthy|unhealthy|none)
31
+                        - id=<ID> a container's ID
32
+                        - isolation=(`default`|`process`|`hyperv`) (Windows daemon only)
33
+                        - is-task=(true|false)
27 34
                         - label=<key> or label=<key>=<value>
28
-                        - status=(created|restarting|removing|running|paused|exited)
29 35
                         - name=<string> a container's name
30
-                        - id=<ID> a container's ID
31
-                        - before=(<container-name>|<container-id>)
36
+                        - network=(<network-id>|<network-name>)
32 37
                         - since=(<container-name>|<container-id>)
33
-                        - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>)
34
-                          containers created from an image or a descendant.
35
-                        - is-task=(true|false)
36
-                        - health=(starting|healthy|unhealthy|none)
38
+                        - status=(created|restarting|removing|running|paused|exited) 
39
+                        - volume=(<volume name>|<mount point destination>)
37 40
       --format string   Pretty-print containers using a Go template
38 41
       --help            Print usage
39 42
   -n, --last int        Show n last created containers (includes all states) (default -1)
... ...
@@ -966,7 +966,7 @@ func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *check.C) {
966 966
 	}
967 967
 	status, _, err := d.SockRequest("POST", "/swarm/init", req)
968 968
 	c.Assert(err, checker.IsNil)
969
-	c.Assert(status, checker.Equals, http.StatusInternalServerError)
969
+	c.Assert(status, checker.Equals, http.StatusBadRequest)
970 970
 
971 971
 	req2 := swarm.JoinRequest{
972 972
 		ListenAddr:  "0.0.0.0:2377",
... ...
@@ -974,7 +974,7 @@ func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *check.C) {
974 974
 	}
975 975
 	status, _, err = d.SockRequest("POST", "/swarm/join", req2)
976 976
 	c.Assert(err, checker.IsNil)
977
-	c.Assert(status, checker.Equals, http.StatusInternalServerError)
977
+	c.Assert(status, checker.Equals, http.StatusBadRequest)
978 978
 }
979 979
 
980 980
 func (s *DockerSwarmSuite) TestAPISwarmForceNewCluster(c *check.C) {