Commit Graph

89 Commits

Author SHA1 Message Date
df1baac4fc Refactoring ineffectual assignments
This patch fixed below 4 types of code line
1. Remove unnecessary variable assignment
2. Use variables declaration instead of explicit initial zero value
3. Change variable name to underbar when variable not used
4. Add erro check and return for ignored error

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Upstream-commit: 266900235c
Component: cli
2017-01-13 00:27:01 -07:00
7a6a7e6b80 Merge pull request #29226 from yongtang/28535-prune-until-follow-up
Add `--filter until=<timestamp>` for `docker container/image prune`
Upstream-commit: 39c5af4a85
Component: cli
2017-01-09 17:58:01 +01:00
058574859e Merge pull request #29688 from tronicum/since-flag
explain since format and give examples
Upstream-commit: 092eb696e9
Component: cli
2017-01-09 09:27:30 -05:00
d499070791 explain since format and give examples
Signed-off-by: tronicum <tronicum@user.github.com>
Upstream-commit: 6081f43bd1
Component: cli
2017-01-08 05:27:54 +01:00
c902dd671a Add --filter until=<timestamp> for docker container/image prune
This fix is a follow up for comment
https://github.com/docker/docker/pull/28535#issuecomment-263215225

This fix provides `--filter until=<timestamp>` for `docker container/image prune`.

This fix adds `--filter until=<timestamp>` to `docker container/image prune`
so that it is possible to specify a timestamp and prune those containers/images
that are earlier than the timestamp.

Related docs has been updated

Several integration tests have been added to cover changes.

This fix fixes #28497.

This fix is related to #28535.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: e2416af013
Component: cli
2017-01-04 14:16:42 -08:00
a1174cb059 keep network option consistent between network connect and run
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 567b554540
Component: cli
2017-01-04 19:54:03 +08:00
1f9f54deef Merge pull request #29683 from vdemeester/runconfig-clean
Clean some stuff from runconfig that are cli only…
Upstream-commit: 2e880dd199
Component: cli
2016-12-29 17:42:08 +01:00
c38ac069ca Merge pull request #29687 from thaJeztah/cleanup-cli-command-container
Minor cleanups in cli/command/container
Upstream-commit: 734f695b29
Component: cli
2016-12-29 09:31:46 +01:00
abab494a4f Support for docker content trust for plugins
Add integration test for docker content trust

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: fcaa89f296
Component: cli
2016-12-27 12:51:00 -08:00
f820fb530f Minor cleanups in cli/command/container
This change does some minor cleanups in the
cli/command/container package;

- sort imports
- replace `fmt.Fprintf()` with `fmt.Fprintln()` if no formatting is used
- replace `fmt.Errorf()` with `errors.New()` if no formatting is used
- remove some redundant `else`'s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f459796896
Component: cli
2016-12-26 01:33:25 +01:00
f912773c28 Clean some stuff from runconfig that are cli only…
… or could be in `opts` package. Having `runconfig/opts` and `opts`
doesn't really make sense and make it difficult to know where to put
some code.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6726879382
Component: cli
2016-12-24 13:16:00 +01:00
d1cd767c90 Merge pull request #29314 from vdemeester/no-more-utils
Remove the utils package
Upstream-commit: 6c1299e819
Component: cli
2016-12-22 15:21:05 +01:00
4b4fbe7e43 Merge pull request #29603 from mstanleyjones/docker_diff_improvements
Clarify what docker diff shows
Upstream-commit: ea51e6159f
Component: cli
2016-12-22 15:15:01 +01:00
618dee8851 Merge pull request #28714 from thaJeztah/move-logdriver-check-to-daemon
move check for supported drivers to daemon
Upstream-commit: 63677ef495
Component: cli
2016-12-21 13:47:30 -05:00
d11aa2f821 Clarify what docker diff shows
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: 606a16a07d
Component: cli
2016-12-20 17:03:11 -08:00
2858451cf0 remove client-side for supported logging drivers
The `docker logs` command performed a
client-side check if the container's
logging driver was supported.

Now that we allow the client to connect
to both "older" and "newer" daemon versions,
this check is best done daemon-side.

This patch remove the check on the client
side, and leaves validation to the daemon,
which should be the source of truth.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 8246c49498
Component: cli
2016-12-19 14:30:01 +01:00
12d8535d84 Improve error output for docker stats ...
While looking into `docker stats <c1> <c2> ...` I noticed that
the error output is quite long, especially if there are multiple errors:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
: Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
: Error response from daemon: No such container: nofound, : Error response from daemon: No such container: foo, : Error response from daemon: No such container: bar
```

There are several issues,
1. There is an extra `: ` at the beginning. That is because if container is not found,
the name will not be available from the daemon.
2. Multiple errors are concatenated with `, ` which will be quite long.

This fix:
1. Only prient out the error from daemon.
2. Multiple errors are printed out line by line.

Below is the new output:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
Error response from daemon: No such container: nofound
Error response from daemon: No such container: foo
Error response from daemon: No such container: bar
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: c6b3fcbe32
Component: cli
2016-12-17 16:51:11 -08:00
8f86ac53c1 Move templates to pkg/templates
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 26fca512dd
Component: cli
2016-12-12 09:34:03 +01:00
b4cfb614da Convert DanglingOnly to Filters for docker image prune
This fix convert DanglingOnly in ImagesPruneConfig to Filters,
so that it is possible to maintain API compatibility in the future.

Several integration tests have been added to cover changes.

This fix is related to 28497.

A follow up to this PR will be done once this PR is merged.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: dd39897fca
Component: cli
2016-12-02 20:08:49 -08:00
2b3cea2450 Merge pull request #28445 from cpuguy83/28439_fix_client_rm_on_old_daemons
Handle `run --rm` against older daemons on the cli
Upstream-commit: 1318c8dcb4
Component: cli
2016-11-22 14:25:03 +01:00
a08156a072 fix incorrect ErrConnectFailed comparison
Signed-off-by: Reficul <xuzhenglun@gmail.com>
Upstream-commit: 14770269e8
Component: cli
2016-11-22 10:42:55 +08:00
e727185cfe Handle run --rm against older daemons on the cli
For previous versions of Docker, `--rm` was handled client side, as such
there was no support in the daemon for it.
Now it is handled daemon side, but we still need to handle the case of a
newer client talking to an older daemon.

Falls back to client-side removal when the daemon does not support it.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4632a029d9
Component: cli
2016-11-21 20:39:04 -05:00
c539a33a54 Merge pull request #28347 from yongtang/28339-ignore-unkwnon-field-template
Use `map[string]bool` for `preProcessor` to ignore unknown fields
Upstream-commit: e59facceb7
Component: cli
2016-11-17 15:13:02 -08:00
7487e32054 refactor help func in CLI
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 55908f8a82
Component: cli
2016-11-17 10:54:10 -08:00
75b9b9e6bd Use map[string]bool for preProcessor to ignore unknwon field
This fix is an attempt to address the issue raised in 28339. In
`docker ps`, the formatter needs to expose all fields of `types.Container`
to `preProcessor` so that template could be executed.

This direct exposing is unreliable and could cause issues as user may incorrectly
assume all fields in `types.Container` will be available for templating.

However, the purpose of `preProcessor` is to only find out if `.Size`
is defined (so that opts.size could be set accordingly).

This fix defines `preProcessor` as `map[string]bool` with a func `Size()`.
In this way, any unknown fields will be ignored.

This fix adds several test cases to the existing `TestBuildContainerListOptions`.

This fix fixes 28339.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 3c56459801
Component: cli
2016-11-16 13:23:47 -08:00
2036ffc43b Fix issue with missing fields for ps template
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: d3169abc3b
Component: cli
2016-11-12 11:23:21 -05:00
f1ed942575 context.Context should be the first parameter of a function
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
Upstream-commit: 0f6af2074c
Component: cli
2016-11-12 14:14:34 +08:00
a99e0f963e Merge pull request #28231 from yuexiao-wang/container-exec
Remove redundant parameter and fix typos
Upstream-commit: 005a3037de
Component: cli
2016-11-11 09:55:42 +08:00
16caab97a6 Merge pull request #27797 from vdemeester/stats-format-names-support
Add support for Names and ID in stats format
Upstream-commit: 6bf79deab5
Component: cli
2016-11-10 13:26:00 -08:00
31f3e07b0b Remove redundant parameter and fix typos
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: b6fe99530c
Component: cli
2016-11-10 11:05:31 +08:00
d1e699cd15 Merge pull request #27947 from milindchawre/fix_27798
Fixes #27798 : Update help for --blkio-weight parameter
Upstream-commit: 2332454882
Component: cli
2016-11-09 15:35:38 +01:00
cc55a23f4c Update function name for TestCalculBlockIO
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 18caa28b66
Component: cli
2016-11-09 17:43:10 +08:00
307edac963 always add but hide experimental cmds and flags
Signed-off-by: Victor Vieux <vieux@docker.com>

update cobra and use Tags

Signed-off-by: Victor Vieux <vieux@docker.com>

allow client to talk to an older server

Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 4ae7176ffb
Component: cli
2016-11-08 04:55:27 -08:00
4cd3911d13 context.Context should be the first parameter of a function
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
Upstream-commit: 7113bbf2c6
Component: cli
2016-11-08 14:51:17 +08:00
75f0b0b043 update cobra and use Tags
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 1e10649f55
Component: cli
2016-11-04 12:04:14 -07:00
25608ce8d4 always add but hide experimental cmds and flags
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: eb522dac24
Component: cli
2016-11-03 17:31:12 -07:00
a3d3423005 fix double [y/N] in container prune
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 3014d36cd9
Component: cli
2016-11-03 10:33:17 -07:00
1e7ea7f047 Fixes #27798 : Update help for --blkio-weight parameter
Signed-off-by: milindchawre <milindchawre@gmail.com>
Upstream-commit: ec7d9291b8
Component: cli
2016-11-03 06:42:15 +00:00
b5f18791bf Add support for Names and ID in stats format
This adds support to display names or id of container instead of what
was provided in the request.

This keeps the default behavior (`docker stats byname` will display
`byname` in the `CONTAINER` colmun and `docker stats byid` will display
the id in the `CONTAINER` column) but adds two new format directive.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 07f77b78ea
Component: cli
2016-11-03 07:20:46 +01:00
7caa97e5c7 Merge pull request #27948 from WeiZhang555/consistent-filters
Replace all "Filter" field with "Filters" for consistency
Upstream-commit: 81e6e5e36d
Component: cli
2016-11-02 00:53:15 -07:00
bee99c14d9 Merge pull request #27864 from vdemeester/add-statsformat-to-configfile
Add StatsFormat to the config.json file
Upstream-commit: 63719e1a24
Component: cli
2016-11-01 20:32:13 -07:00
ca8b6d0b28 Replace all "Filter" field with "Filters" for consistency
In file `api/types/client.go`, some of the "*Options{}" structs own a
`Filters` field while some else have the name of `Filter`, this commit
will rename all `Filter` to `Filters` for consistency. Also `Filters`
is consistent with API with format `/xxx?filters=xxx`, that's why
`Filters` is the right name.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 9eceaa926f
Component: cli
2016-11-01 23:09:30 +08:00
5175d100a2 Generate container create response from swagger spec.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: e7e0837702
Component: cli
2016-10-31 11:16:02 -04:00
e527c56131 Add StatsFormat to the config.json file
As for `ps`, `images`, `network ls` and `volume ls`, this makes it
possible to define a custom default format.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 908aa5b408
Component: cli
2016-10-28 11:48:25 -07:00
5099913cf9 Allow providing a custom storage directory for docker checkpoints
Signed-off-by: boucher <rboucher@gmail.com>
Upstream-commit: 5ddcbc3c00
Component: cli
2016-10-28 07:56:05 -04:00
38aff80fff Merge pull request #27759 from Microsoft/jjh/fixstats
Windows: Fix stats CLI
Upstream-commit: 3b4084cb50
Component: cli
2016-10-26 18:17:18 -07:00
46742b9fba Implementing support for --cpu-rt-period and --cpu-rt-runtime so that
containers may specify these cgroup values at runtime. This will allow
processes to change their priority to real-time within the container
when CONFIG_RT_GROUP_SCHED is enabled in the kernel. See #22380.

Also added sanity checks for the new --cpu-rt-runtime and --cpu-rt-period
flags to ensure that that the kernel supports these features and that
runtime is not greater than period.

Daemon will support a --cpu-rt-runtime flag to initialize the parent
cgroup on startup, this prevents the administrator from alotting runtime
to docker after each restart.

There are additional checks that could be added but maybe too far? Check
parent cgroups to ensure values are <= parent, inspecting rtprio ulimit
and issuing a warning.

Signed-off-by: Erik St. Martin <alakriti@gmail.com>
Upstream-commit: 4f320d7c2a
Component: cli
2016-10-26 11:33:06 -04:00
84e8a755f4 Windows: Fix stats CLI
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: dff7842790
Component: cli
2016-10-25 19:57:47 -07:00
2451915c27 Make experimental a runtime flag
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 66bd963b76
Component: cli
2016-10-24 15:20:01 -07:00
fe241a941a Merge pull request #27564 from mlaventure/add-networks-format-to-ps
Add Networks placeholder to ps --format
Upstream-commit: 85a65c7536
Component: cli
2016-10-20 18:43:46 -07:00