Commit Graph

83 Commits

Author SHA1 Message Date
4489cc6ffc Merge pull request #30962 from TheHipbot/30431-implement-format-for-history-with-docs
30431 implement format for history with docs
Upstream-commit: a3ab46361ee91dc99790e84369b4865572bd9f8c
Component: engine
2017-04-16 10:34:41 -07:00
62078c31fe Hide zero-valued timestamps from service JSON
It was possible to see output like this:

        "UpdateStatus": {
            "State": "updating",
            "StartedAt": "2017-04-14T17:10:03.226607162Z",
            "CompletedAt": "1970-01-01T00:00:00Z",
            "Message": "update in progress"
        }

The timestamp fields were already changed to pointers, and left nil if
the timestamp value was zero. However the zero-value of a timestamp from
gRPC is different from the value Go considers to be zero. gRPC uses the
Unix epoch instead of Go's epoch. Therefore, check that the timestamp
does not match the Unix epoch.

Also, add " ago" to the timestamps as shown in "docker service inspect
--pretty", as they are shown as relative times.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 8a27758364a151d9497cbb507463e81898579c37
Component: engine
2017-04-14 10:44:24 -07:00
e9836650c4 Merge pull request #31482 from ripcurld0/add_format_to_system_df
Add format to the docker system df command
Upstream-commit: 0b35ab196546a4de068060f10418cc5416d5b62c
Component: engine
2017-04-13 10:08:11 -07:00
bdda1a695e Merge pull request #32116 from mkumatag/inspect_template
Adopt text/template in node inspect
Upstream-commit: ec207ce186bff1804f49c456f77fe7d377e63d30
Component: engine
2017-04-10 23:02:26 +02:00
708ad46cdf Adopt text/template in node inspect
Signed-off-by: Manjunath A Kumatagi <mkumatag@in.ibm.com>
Upstream-commit: 5dbd6afb5144a937df73bfe42364e583e789d80d
Component: engine
2017-04-10 17:47:15 +05:30
6633b439bb Add format to the docker system df command
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 985a9c7047616885454951e7c8282f3c94f6d6e9
Component: engine
2017-04-10 13:04:03 +03:00
b9faf048c8 Show network names in "docker service inspect --pretty"
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 56f1da77c33dcc5e752dce2694887878f93ffea6
Component: engine
2017-04-07 16:46:25 -07:00
1623433ab1 Add support for update order
This parameter controls the order of operations when rolling out an
update task. Either the old task is stopped before starting the new one,
or the new task is started first, and the running tasks will briefly
overlap.

This commit adds Rollout to the API, and --update-order / --rollback-order
flags to the CLI.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 9b54994a8ada6ae15a4d2c3b925568e2061200ad
Component: engine
2017-04-06 17:23:36 -07:00
964a70f1c3 Add hidden placeholder of .Self for docker node ls --format
This commit adds a hidden placeholder of `.Self` for
`docker node ls --format` so that if the node is the same
as the current docker daemon, then a `*` is outputed.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 7328ae12cc3e14b3eb6ab01f09f6d94a82a44066
Component: engine
2017-04-04 12:46:44 -07:00
c7270d4d81 Add --format for docker node ls
This fix tries to address the comment https://github.com/docker/docker/pull/30376#discussion_r97465334
where it was not possible to specify `--format` for `docker node ls`. The `--format` flag
is a quite useful flag that could be used in many places such as completion.

This fix implements `--format` for `docker node ls` and add `nodesFormat` in config.json
so that it is possible to specify the output when `docker node ls` is invoked.

Related documentations have been updated.

A set of unit tests have been added.

This fix is related to #30376.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 32e21ecbfe3af9a8b5762ad1a549518221c4939e
Component: engine
2017-04-04 11:26:35 -07:00
881ae30412 Add PORTS field for docker service ls (ingress)
This fix is related to 30232 wherw `docker service ls`
does not show `PORTS` information like `docker service ps`.

This fix adds `PORTS` fields for services that publish
ports in ingress mode.

Additional unit tests cases have been updated.

This fix is related to 30232.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: c877c7b2bf0ed20ff9054dcbec98362d9e88c145
Component: engine
2017-04-03 18:40:15 -07:00
1d7af76811 Merge pull request #31800 from ripcurld0/checkpoint_ls
Use formatter in docker checkpoint ls
Upstream-commit: e45483964fc26116afa754fc9defcf1ab1dbca26
Component: engine
2017-03-31 15:54:22 -07:00
d3486384e9 Use formatter in docker diff
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 3dad39b957a008127890ddf9037c063d69b99347
Component: engine
2017-03-30 10:33:40 +03:00
7cc7eec39f Replace fmt.Errorf() with errors.Errorf() in the cli
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7b7ea8ab810190018346cb7d84c161bb94f7ca60
Component: engine
2017-03-24 16:58:07 -04:00
c622412e5c Use formatter in docker checkpoint ls
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: f9d2636787e2c1c1bff02f51fded9094236e235a
Component: engine
2017-03-19 09:24:15 +02:00
6d6cf437f8 Add format to secret ls
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: e281fe9c3a0034e119e7718a142133e86f38a4f2
Component: engine
2017-03-19 09:22:30 +02:00
77bcd83cef Implements --format option for docker history command by creating a formatter
Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds to history documentation for --format

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds MarshalJSON to historyContext for {{json .}} format

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds back the --human option to history command

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Cleans up formatter around --human option for history, Adds integration test for --format option of history

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds test for history formatter checking full table results, Runs go fmt on touched files

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Fixes lint errors in formatter/history

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Runs go fmt on cli/command/formatter/history.go

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

sRemoves integration test for --format option of history

Merges Created and CreatedSince in docker history formatter, Updates docs and tests
Upstream-commit: 6bc1f345af77fcf8f1f34b66ae51c314cc63401e
Component: engine
2017-03-11 13:54:16 -06:00
ac66308e6c Add support for rollback flags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 3a88a24d23e6eb1ca521cd9ab6e306d4ba1c1464
Component: engine
2017-03-03 16:33:34 -08:00
146a801e5a Fix error caused by overlapping merge of 30733
This fix fixes build error caused by overlapping merge of 30733 and 28213.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: f2197b679401627610a7efc8adb9ddc27b5af02f
Component: engine
2017-03-03 13:26:00 -08:00
8d9c7cbbe3 Merge pull request #30733 from yongtang/02022017-formatter-header
Allow `--format` to use different delim in `table` format
Upstream-commit: 9369acc776be47eb4163ee97153aefa0a4e647a0
Component: engine
2017-03-03 11:25:19 -08:00
737f03c444 Topology-aware scheduling
This adds support for placement preferences in Swarm services.

- Convert PlacementPreferences between GRPC API and HTTP API
- Add --placement-pref, --placement-pref-add and --placement-pref-rm to CLI
- Add support for placement preferences in service inspect --pretty
- Add integration test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 17288c611a4f3f75ecb3bbb4533820b1836c55a6
Component: engine
2017-02-27 13:29:54 -08:00
ee40a8603d Fixed typo.
Signed-off-by: Genki Takiuchi <genki@s21g.com>
Upstream-commit: d654c3d83152a4bf879ddf04ae637d1e424453ee
Component: engine
2017-02-26 12:59:18 +09:00
b7f72f988d Merge pull request #28213 from yongtang/11062016-service-ps-format
Add `--format` to `docker service ps`
Upstream-commit: b1debf1374ca7be7e7b4d4fcd41eceaf8b7cf153
Component: engine
2017-02-17 10:23:18 -08:00
7fdc39f1fc Merge pull request #30848 from nishanttotla/suppress-digest-docker-ps
Suppressing image digest in docker ps
Upstream-commit: 40532143c2c4cf1359fd8484789b81c1f1f59d98
Component: engine
2017-02-17 10:27:49 +01:00
5361825be7 Suppressing image digest in docker ps
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: b04536f61fe9d8e9827832e0cef02cc2c5cef003
Component: engine
2017-02-16 18:11:56 -08:00
29e3dcbbb0 why there are so many mistakes in our repo (up to /cmd)
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
Upstream-commit: f8a40477960976f12dbbb72e5b133b5b0f05f9b3
Component: engine
2017-02-17 00:32:48 +08:00
b2b138d38f Ignore some functions in the Go template when header is rendered
This fix ignore some functions in the Go template when header is
redendered, so that `--format "{{truncate .ID 1}}"` will still
be able to redener the header correctly.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8b165cad1aa8ce00ecc293ac0be82dd01392e548
Component: engine
2017-02-10 19:34:50 -08:00
5915ac4ad4 Allow --format to use different delim in table format
This fix is an attempt to address
https://github.com/docker/docker/pull/28213#issuecomment-273840405

Currently when specify table format with table `--format "table {{.ID}}..."`,
the delimiter in the header section of the table is always `"\t"`.
That is actually different from the content of the table as the delimiter
could be anything (or even contatenated with `.`, for example):
```
$ docker service ps web --format 'table {{.Name}}.{{.ID}}' --no-trunc

NAME                ID
web.1.inyhxhvjcijl0hdbu8lgrwwh7
 \_ web.1.p9m4kx2srjqmfms4igam0uqlb
```

This fix is an attampt to address the skewness of the table when delimiter
is not `"\t"`.

The basic idea is that, when header consists of `table` key, the header section
will be redendered the same way as content section. A map mapping each
placeholder name to the HEADER entry name is used for the context of the header.

Unit tests have been updated and added to cover the changes.

This fix is related to #28313.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: ea61dac9e6d04879445f9c34729055ac1bb15050
Component: engine
2017-02-10 19:34:50 -08:00
08e260c901 Add --format to docker service ps
This fix tries to address the issue raised in 27189 where
it is not possible to support configured formatting stored in
config.json.

Since `--format` was not supported in `docker service ps`,
the flag `--format` has also been added in this fix.

This fix
1. Add `--format` to `docker service ps`
2. Add `tasksFormat` to config.json
3. Add `--format` to `docker stack ps`
4. Add `--format` to `docker node ps`

The related docs has been updated.

An integration test has been added.

This fix fixes 27189.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: f8c7c921d905615acf1d2c6577ae1cfb4600bec0
Component: engine
2017-02-10 16:53:04 -08:00
a30a294780 Add = before the value of PublishedPort
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
Upstream-commit: e9a85c59097a61f85dabe3fd059b89739636a0e7
Component: engine
2017-02-10 14:53:18 +08:00
466e8e21b6 Merge pull request #30776 from WeiZhang555/stats-all-format-name-panic-cli
Fix panic of "docker stats --format {{.Name}} --all"
Upstream-commit: f5116c680207a12ecd9c4fa654a1a5707e7ac89c
Component: engine
2017-02-08 11:40:06 -08:00
b520dbb06a Fix panic of "docker stats --format {{.Name}} --all"
This commit fixes panic when execute stats command:

* use --format {{.Name}} with --all when there're exited containers.
* use --format {{.Name}} while stating exited container.

The root cause is when stating an exited container, the result from the
api didn't contain the Name and ID field, which will make format
process panic.

Panic log is like this:

```
panic: runtime error: slice bounds out of range [recovered]
	panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0xb20f80, 0xc420014110)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
text/template.errRecover(0xc4201773e8)
	/usr/local/go/src/text/template/exec.go:140 +0x2ad
panic(0xb20f80, 0xc420014110)
	/usr/local/go/src/runtime/panic.go:458 +0x243
github.com/docker/docker/cli/command/formatter.(*containerStatsContext).Name(0xc420430160,
0x0, 0x0)
	/go/src/github.com/docker/docker/cli/command/formatter/stats.go:148
+0x86
reflect.Value.call(0xb9a3a0, 0xc420430160, 0x2213, 0xbe3657, 0x4,
0x11bc9f8, 0x0, 0x0, 0x4d75b3, 0x1198940, ...)
	/usr/local/go/src/reflect/value.go:434 +0x5c8
reflect.Value.Call(0xb9a3a0, 0xc420430160, 0x2213, 0x11bc9f8, 0x0, 0x0,
0xc420424028, 0xb, 0xb)
	/usr/local/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc420177368, 0xb9a3a0, 0xc420430160,
0x16, 0xb9a3a0, 0xc420430160, 0x2213, 0x1178fa0, 0xc4203ea330,
0xc4203de283, ...)
	/usr/local/go/src/text/template/exec.go:658 +0x530
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 5a7b3c78e06081fb2d44b6f4296cb416ab91aaff
Component: engine
2017-02-08 10:26:52 +08:00
14c3328b3b Merge pull request #30790 from vdemeester/pr-30602
Carry #30602 : Bump go-units
Upstream-commit: 31f172bdb50091be8880caac83046401bb43fc17
Component: engine
2017-02-08 11:04:22 +09:00
c355cec53c Merge pull request #30457 from dmcgowan/distribution-reference-update-2
reference: use distribution reference and remove fork
Upstream-commit: 254fc83cba90ed79c78f4cb0cb33aeeaff492798
Component: engine
2017-02-07 22:01:25 +01:00
e1911d98d5 Bump go-units
To include  https://github.com/docker/go-units/pull/23
Fixes a unit test that fails because of it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: cb89d658dc6dca5f0efa21cac168ae82fea821d1
Component: engine
2017-02-07 21:58:56 +01:00
2260389fe6 Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 3a1279393faf78632bf169619d407e584da84b66
Component: engine
2017-02-07 11:08:37 -08:00
190522d7df Fix Windows docker stats showing Linux headers
This fix is an attempt to fix issue raised in #28005 where
`docker stats` on Windows shows Linux headers if there is
no containers in stats.

The reason for the issue is that, in case there is no container,
a header is faked in:
https://github.com/docker/docker/blob/v1.13.0/cli/command/formatter/formatter.go#L74-L78
which does not know OS type information (as OS was stored with container stat entries)

This fix tries to fix the issue by moving OS type information
to stats context (instead of individual container stats entry).

Additional unit tests have been added.

This fix fixes #28005.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 0a3a3ba2b62a5720d949e93fd580d3cf797cfa9e
Component: engine
2017-02-05 08:55:30 -08:00
28da29ca6e Add docker plugin upgrade
This allows a plugin to be upgraded without requiring to
uninstall/reinstall a plugin.
Since plugin resources (e.g. volumes) are tied to a plugin ID, this is
important to ensure resources aren't lost.

The plugin must be disabled while upgrading (errors out if enabled).
This does not add any convenience flags for automatically
disabling/re-enabling the plugin during before/after upgrade.

Since an upgrade may change requested permissions, the user is required
to accept permissions just like `docker plugin install`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 03c694973968f63743ed53cef83d0b7455695081
Component: engine
2017-02-03 16:21:12 -05:00
256ff53fbd Add --format to docker service ls
This fix tries to improve the display of `docker service ls`
and adds `--format` flag to `docker service ls`.

In addition to `--format` flag, several other improvement:
1. Updates `docker stacks service`.
2. Adds `servicesFormat` to config file.

Related docs has been updated.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 000f0403d9084e8da427bafac3b594a822b3c386
Component: engine
2017-02-01 08:33:19 -08:00
0dedd22a73 Merge pull request #30043 from dmcgowan/distribution-reference-update-1
Distribution reference update
Upstream-commit: e9c0de0de65182915d1cd205f06f5c903c20a29f
Component: engine
2017-01-24 20:38:20 -08:00
465587cda7 Merge pull request #30378 from mlaventure/fix-negative-size
Ensure proper value is used when computing reclaimable space
Upstream-commit: ee7682ebaedba6025f585c3ab6f0d61513e54e06
Component: engine
2017-01-24 09:24:53 -05:00
c6a1cf9cb8 Merge pull request #29900 from yongtang/29226-network-format-created-at
Add `.CreatedAt` placeholder for `docker network ls --format`
Upstream-commit: 8820266c17beede7d08b6b077383978f3b7b239f
Component: engine
2017-01-24 11:01:37 +01:00
b5ccc2ae09 Ensure proper value is used when computing reclaimable space
When Size was reverted to be equal to VirtualSize, the df command
formatter was not correctly updated to account for the change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: dcc1b4baf6d0eb068010d071bc44daf72b12cd4a
Component: engine
2017-01-23 13:57:20 -08:00
4d4ab77f0f Merge pull request #29088 from yongtang/28708-plugin-list-format
Add `--format` flag for `docker plugin ls`
Upstream-commit: 8bb8ac7f788b258ee17473d9f2779341506aed0a
Component: engine
2017-01-23 08:49:28 -08:00
5fa515a0ff Add --format flag for docker plugin ls
This fix tries to address the enhancement discussed in 28735 to add
`--format` for the output of `docker plugin ls`.

This fix
1. Add `--format` and `--quiet` flags to `docker plugin ls`
2. Convert the current implementation to use `formatter`, consistent with
   other docker list commands.
3. Add `pluginsFormat` for config.json.

Related docs has been updated.

Several unit tests have been added to cover the changes.

This fix is related to 28708 and 28735.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 1c0d37fa7f04ade13e65aff74ea0495bb846d782
Component: engine
2017-01-20 15:59:44 -08:00
027b11b8c3 Remove use of forked reference package for cli
Use resolving to repo info as the split point between the
legitimate reference package and forked reference package.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 0421f5173dbdcb4e4eade5267f274302bb6ab97c
Component: engine
2017-01-19 16:04:50 -08:00
9977ce25d8 Fix broken JSON support in cli/command/formatter
How to test (it should not print `{}`, and just returns JSON with the actual data):

   $ docker images --format '{{json .}}'
   $ docker container stats --format '{{json .}}'

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 26013fcdd64221c858022392a1430a6c43eaaa26
Component: engine
2017-01-19 09:51:13 +00:00
0bc7b63417 correct all the formate to formatter
Signed-off-by: kaiwentan <kaiwentan@harmonycloud.cn>
Upstream-commit: b8155bd5bead29bf116aeea9159563e1a6409c41
Component: engine
2017-01-19 11:26:49 +08:00
07dc948442 Fix ImageSummary.Size value
The prune PR changed the meaning of the file to mean "space on disk
only unique to this image", this PR revert this change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: be20dc15af0cb281bd6d11586cfcc96bd50d12ca
Component: engine
2017-01-12 07:49:22 -08:00
ccb8041876 add port PublishMode to service inspect --pretty output
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
Upstream-commit: 5470312d236445b54bb6723f47c0966d3b057658
Component: engine
2017-01-09 10:30:28 -08:00