浏览代码

add creation timestamp to `docker network inspect`

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Akihiro Suda 8 年之前
父节点
当前提交
b5bb7de5d2

+ 1 - 0
api/server/router/network/network_routes.go

@@ -159,6 +159,7 @@ func (n *networkRouter) buildNetworkResource(nw libnetwork.Network) *types.Netwo
 	info := nw.Info()
 	r.Name = nw.Name()
 	r.ID = nw.ID()
+	r.Created = info.Created()
 	r.Scope = info.Scope()
 	if n.clusterProvider.IsManager() {
 		if _, err := n.clusterProvider.GetNetwork(nw.Name()); err == nil {

+ 1 - 0
api/types/types.go

@@ -470,6 +470,7 @@ type VolumeCreateRequest struct {
 type NetworkResource struct {
 	Name       string                      // Name is the requested name of the network
 	ID         string                      `json:"Id"` // ID uniquely identifies a network on a single machine
+	Created    time.Time                   // Created is the time the network created
 	Scope      string                      // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level)
 	Driver     string                      // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
 	EnableIPv6 bool                        // EnableIPv6 represents whether to enable IPv6

+ 1 - 0
docs/reference/api/docker_remote_api.md

@@ -130,6 +130,7 @@ This section lists each version from latest to oldest.  Each listing includes a
   containers that are tasks (part of a service in swarm mode).
 * `POST /containers/create` now takes `StopTimeout` field.
 * `POST /services/create` and `POST /services/(id or name)/update` now accept `Monitor` and `MaxFailureRatio` parameters, which control the response to failures during service updates.
+* `GET /networks/(name)` now returns `Created`.
 
 ### v1.24 API changes
 

+ 4 - 0
docs/reference/api/docker_remote_api_v1.25.md

@@ -3528,6 +3528,7 @@ Content-Type: application/json
   {
     "Name": "bridge",
     "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
+    "Created": "2016-10-19T06:21:00.416543526Z",
     "Scope": "local",
     "Driver": "bridge",
     "EnableIPv6": false,
@@ -3560,6 +3561,7 @@ Content-Type: application/json
   {
     "Name": "none",
     "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
+    "Created": "0001-01-01T00:00:00Z",
     "Scope": "local",
     "Driver": "null",
     "EnableIPv6": false,
@@ -3574,6 +3576,7 @@ Content-Type: application/json
   {
     "Name": "host",
     "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
+    "Created": "0001-01-01T00:00:00Z",
     "Scope": "local",
     "Driver": "host",
     "EnableIPv6": false,
@@ -3619,6 +3622,7 @@ Content-Type: application/json
 {
   "Name": "net01",
   "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
+  "Created": "2016-10-19T04:33:30.360899459Z",
   "Scope": "local",
   "Driver": "bridge",
   "EnableIPv6": false,

+ 2 - 0
docs/reference/commandline/network_inspect.md

@@ -41,6 +41,7 @@ $ sudo docker network inspect bridge
     {
         "Name": "bridge",
         "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f",
+        "Created": "2016-10-19T04:33:30.360899459Z",
         "Scope": "local",
         "Driver": "bridge",
         "IPAM": {
@@ -92,6 +93,7 @@ $ docker network inspect simple-network
     {
         "Name": "simple-network",
         "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
+        "Created": "2016-10-19T04:33:30.360899459Z",
         "Scope": "local",
         "Driver": "bridge",
         "IPAM": {