Commit Graph

77 Commits

Author SHA1 Message Date
94abb34940 add support for filtering by network ID
This adds support for filtering by network ID, to be
consistent with other filter options.

Note that only *full* matches are returned; this is
consistent with other filters (e.g. volume), that
also return full matches only.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 7c46ba02e694ae540866b29ebf0dab76e556cc13
Component: engine
2016-06-07 16:50:31 +02:00
4e024e3e7d Adding network filter to docker ps command
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Upstream-commit: 912af1ae8f22c4d9d7e478d0985a40b41ded2027
Component: engine
2016-06-07 16:43:11 +02:00
69ba7aeaeb Add a check for size field in custom format string
This fix addresses an issue where including the `{{.Size}}` format
field in conjunction with `docker ps --format`, without the `--size`
flag, would not correctly display the size of containers.

This is done by doing a check on the custom format string, and setting
the size flag on the options struct if the field is found. This struct
gets passed to the engine API which then generates the correct query.

An integration test is included which runs `docker ps --format "table
{{.Size}}"` without `--size`, and checks that the returned output is
not `0 B`.

Fixes #21991

As suggested by @cpuguy83, a parser is implemented to process the format
string as a template, and then traverses the template tree to determine
if `.Size` was called.

This was then reworked by making use of template execution with a
pre-processor struct that will set the `--size` option if the template
calls for the field.

The pre-processor now also sets a boolean in the context passed to the
writer. There is an integration test for this that calls `docker ps
--size --format "{{.Size}}"` and then checks that `size: {{.Size}}` is
not appended, as it would with previous behavior.

Finally, a change was made to the formatter to not automatically
add a `{{.Size}}` if a custom format is provided.

Signed-off-by: Paulo Ribeiro <paigr.io@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 55cdb6dcd0f709301573ddb9f3348f9288572b91
Component: engine
2016-06-03 21:59:10 +02:00
5dcdbc4a5a Remove deprecated -f flag on docker tag
The -f flag on docker tag has been deprecated in docker 1.10 and
is expected to be removed in docker 1.12.

This fix removed the -f flag on docker tag and also updated
deprecated.md.

NOTE: A separate pull request for engine-api has been opened to
cover the related changes.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 4455ec14b87d5ad474c5e11d60907bceb35e9e09
Component: engine
2016-06-01 09:44:25 -07:00
d4479244ab TestPsGroupPortRange: allocate less ports
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: bdb354f19b485238c42a86ff2a61fc7537da15ee
Component: engine
2016-05-17 12:23:37 +02:00
f5ac686743 Deprecated of docker ps since and before options for v1.12
Deprecated note https://github.com/docker/docker/blob/master/docs/deprecated.md#docker-ps-before-and-since-options

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: 91b715706493059d39c9f8b1d01c9d80ce1799d9
Component: engine
2016-04-19 18:13:55 +08:00
0dfaed7e71 do not trim one char from {{.Names}} each time it is used in --format
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 68ade49adab15429168903f5600ab64ce7f7c8c5
Component: engine
2016-04-06 11:04:13 -07:00
98172de036 Update TestPsShowMounts to also test bind mounts
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: cdd7fddfec70cca2cc228519794281988ef2a15a
Component: engine
2016-03-17 15:43:32 -07:00
75cce52537 Add check about filter name for containers
Fixes: #21202
We add valid check about filters like network, images,
volumes did.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
Upstream-commit: 8a90e8a19b8108ecdff325fc19dbdf945aa15fad
Component: engine
2016-03-16 03:53:40 +00:00
9f546a0928 Reenabled TestPsListContainers* tests and increased sleep time
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: ad7398e664512e2015ea00907d0862dc1b6c73b2
Component: engine
2016-03-04 10:53:04 -08:00
6f4227aa85 Windows CI: Temporarily disable TestPsListContainers*
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 9af22098af836763e994ac272143ce5717c43fba
Component: engine
2016-03-02 20:43:16 -08:00
e32705bbc7 Merge pull request #20480 from wenchma/20431-filter_since_before
Enhancement of docker ps before and since filters
Upstream-commit: 9eb4575f8cdb8f9afb0d53d6fd4a34b077cc08da
Component: engine
2016-02-29 20:57:43 +01:00
f444846f4e integration-cli: remove not necessary -d again
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: e44689139d2ffd08c147ffe940a15a8e8616786a
Component: engine
2016-02-28 13:48:15 +01:00
a59cde77dc Enhancement of docker ps before and since filters
This enhancement is to fix the wrong list results on
`docker ps` before and since filters specifying the non-running container.

Fixes issue #20431

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: bc72883fe13b5cc39235b4996064bea7a5528ebf
Component: engine
2016-02-25 16:58:31 +08:00
edf220176a Add mounts to docker ps.
- Allow to filter containers by volume with `--filter volume=name` and `filter volume=/dest`.
- Show their names in the list with the custom format `{{ .Mounts }}`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: bd4fb00fb6241d35537b460a2d9f48256111ae7a
Component: engine
2016-02-23 12:10:24 -05:00
05a9f24f32 Fix the since and before filter behavior
Filters should not include stopped container if `-a` is not specified.
Right now, before and since filter are acting as --before and --since
deprecated flags. This commit is fixing that.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b41dba58a01855e0d222bd6c14af9874c298c154
Component: engine
2016-02-09 09:26:20 +01:00
e2603dbc62 Windows CI: TP4 reliability hack
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2ebcb48cf1b4f883260b62f687e2c54926749b68
Component: engine
2016-02-01 18:02:57 -08:00
697d1c2bb0 Windows CI: Turn off unreliable TP4 tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 59f4369f1a09462ec0a2c6777931051fc1324396
Component: engine
2016-01-31 15:51:56 -08:00
8bc92ae008 Assert error in body of function inspectField*
1. Replace raw `docker inspect -f xxx` with `inspectField`, to make code
cleaner and more consistent
2. assert the error in function `inspectField*` so we don't need to
assert the return value of it every time, this will make inspect easier.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 62a856e9129c9d5cf7db9ea6322c9073d68e3ea4
Component: engine
2016-01-29 23:39:07 +08:00
7f9cdda847 Factorize sleeping containers
Add `runSleepingContainer` and `runSleepingContainerInImage` helper
functions to factor out the way to run system-specific idle containers.

Define a sleeping container as command `top` in image `busybox` for
Unix and as command `sleep 60` in image `busybox` for Windows. Provide a
single point of code to update those.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 777ee34b075292e5aee16c4088444508899f8f35
Component: engine
2016-01-27 08:48:08 -08:00
2f92225c3a Windows CI: Darn it, I broke due to multiple declarations
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 916b9db71d6de8db8731a6d881079a7a8e61eb64
Component: engine
2016-01-26 19:58:53 -08:00
29ab7a596d Windows CI: Address simple failures in TestPS*
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 75d107451a16161e2ff54753814936fbf6ca0d02
Component: engine
2016-01-23 16:33:45 -08:00
d982e75aca Windows: TestPsNotShowPortsOfStoppedContainer linux only
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 845dc1b24c2b7083ab5b8a8c21f946fed56e61b1
Component: engine
2016-01-21 18:48:21 -08:00
2507868b1a Fix #19477, clean up the ports when release network
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 6025517b68301134614985121f99ccbf3f577d42
Component: engine
2016-01-20 20:09:11 -05:00
f41d29a49b Add --format support to images command
- rename `api/client/ps` to `api/client/formatter`
- add a a image formatter

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 34a3c3cacf2fd827f13a5e37541acff1409658c4
Component: engine
2015-12-21 17:38:07 +01:00
9380772bfb Re-implement --before and --since as options for --filter
* This commit will mark --before and --since as deprecated, but leave their behavior
  unchanged until they are removed, then re-implement them as options for --filter.

* And update the related docs.

* Update the integration tests.

Fixes issue #17716

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: 1921c629381d25ebff7b8b8c8348a0a81525f264
Component: engine
2015-11-20 13:10:13 +08:00
9c09b9b37a Test that paused containers show up filtering by status.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 2a07b19fd8fd402b4ec7b7814f85d099c8b8efca
Component: engine
2015-11-19 14:32:25 -05:00
2e538bcbf1 Remove deprecated cli flags
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 7929888214741c4ab194c44e0b14ac08aca06556
Component: engine
2015-11-15 10:40:01 +01:00
bc15824df1 add c.Assert in docker_cli_ps_test.go
Signed-off-by: Zhang Kun <zkazure@gmail.com>
Upstream-commit: 83b03b00578a27f24dc80bb110d36b1f6eed7684
Component: engine
2015-11-04 17:29:25 +08:00
c03ccb6893 Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f9a3558a9d75ed6a2f9f1b2d80800226afaa74a5
Component: engine
2015-09-04 12:32:40 -07:00
f2ca32df70 Refactor daemon container list.
Separate container iteration, filtering and reducing.
This will make easier in the future to improve the implementation of
docker ps as we know it.

The end goal is to unify the objects returned by the api for docker ps
and docker inspect, leaving all docker ps transformations to the client.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 06699f73fb6d779894a875f9177afc5a1f3bc5b3
Component: engine
2015-08-31 04:24:08 -04:00
e191a06015 Add 'ancestor' ps filter for image
Makes it possible to filter containers by image, using
--filter=ancestor=busybox and get all the container running busybox
image and image based on busybox (to the bottom).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: c1af0ac0820d1385fe2ee65593b0558840395c7b
Component: engine
2015-08-26 22:59:48 +02:00
dd5279c777 Use image ID if tag has been updated
Fixes #12595

Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
Upstream-commit: 2167f40a766d1909443695d96bcecc3d039fb482
Component: engine
2015-08-23 12:11:24 -04:00
e2e0f70ccb Merge pull request #15412 from vdemeester/dont-sleep-too-much
time.Sleep in integration tests — comment and waitRun/waitInspect
Upstream-commit: 5929502b4e05ed82e78347169f3ba705cac8ad35
Component: engine
2015-08-21 20:43:55 -04:00
22da8315f6 Remove/Comment time.Sleep in integration tests
Remove what seems unnecessary time.Sleep (1 second even) and comment the
ones that seemed necessary.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 799d9605d6d37a0f5c559b0325d924ad183ff4ee
Component: engine
2015-08-18 20:36:08 +02:00
4c6bab5f50 Fix ignore -q flag in docker ps when there is a default format.
Docker ps default format should not take precedence over cli flags.
This happens effectively for other flags except `-q`.
We need to let the cli to set the format as table to print the
expected output with `-q`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: df46bfdd4d28dcab432b2fc6c36131ff95223148
Component: engine
2015-08-17 10:48:04 -07:00
6e14356132 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 693ba98cb9118bf15caaabc69ca281c0ce604226
Component: engine
2015-07-27 14:33:32 -04:00
3dbbf38be7 Fix "docker ps" with no containers regression
The header row was not being printed when "docker ps" was invoked without containers thanks to the new format support, and we instead received a single blank line.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: f57fc03e3b39c225a05edfe217bd7616949d0dd0
Component: engine
2015-07-23 13:23:24 -07:00
e60763fbc1 ps --format: Add config.js doc, fix gofmt, add integration tests
Re-add the docs from @calavera's PR to the moved cli cmd reference docs.
Fix gofmt and vet issues from carried commits
Add integration test for using format with --no-trunc and multi-names
Fix custom_test map order dependency on expected value check
Add docs to reference/commandline/ps.md
Remove "-F" flag option from original carried PR content

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 542b58d8f7a2ff3b78a71b7d2c3145dd79f1fa97
Component: engine
2015-07-22 12:51:16 -04:00
abe73960d5 Use dockerCmd when possible (#14603)
- integration-cli/docker_cli_attach_test.go
- integration-cli/docker_cli_attach_unix_test.go
- integration-cli/docker_cli_build_test.go
- integration-cli/docker_cli_build_unix_test.go
- integration-cli/docker_cli_by_digest_test.go
- integration-cli/docker_cli_commit_test.go
- integration-cli/docker_cli_config_test.go
- integration-cli/docker_cli_cp_test.go
- integration-cli/docker_cli_create_test.go
- integration-cli/docker_cli_pause_test.go
- integration-cli/docker_cli_port_test.go
- integration-cli/docker_cli_port_unix_test.go
- integration-cli/docker_cli_proxy_test.go
- integration-cli/docker_cli_ps_test.go
- integration-cli/docker_cli_pull_test.go
- integration-cli/docker_cli_push_test.go

- docker_api_attach_test.go
- docker_api_containers_test.go
- docker_api_events_test.go
- docker_api_exec_resize_test.go
- docker_api_exec_test.go
- docker_api_images_test.go
- docker_api_info_test.go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5c295460da2098d971eda28a73b416ff6be62f53
Component: engine
2015-07-14 21:52:43 +02:00
5d5c8a740d Validate status= filter to docker ps
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 7bf26d44b08de167b18257b5ddf5912585c840df
Component: engine
2015-07-02 16:12:42 -07:00
0fb31101e8 Merge pull request #12838 from fntlnz/test-cmd
Using dockerCmd when possible
Upstream-commit: 6c42b3947a6ad91fc487ba34fec634e9f5c48aea
Component: engine
2015-06-02 14:12:22 -07:00
cc848c594e Add a "Created" state for new containers that haven't been run yet
Closes #13353

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: dc697b1c9f2bf77b5b78aa871e3f365e333fd253
Component: engine
2015-05-30 07:48:46 -07:00
986a53d09e Make docker ps --size show virtual size really work
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: d0de2b1e2f0939b25c83183f450c71b8309d1d32
Component: engine
2015-05-21 08:57:11 +08:00
15949eba4d Using dockerCmd when possible
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
Upstream-commit: a2787469ac45085cc28a56f67b7c0a50bead893f
Component: engine
2015-05-19 20:33:59 +02:00
6982f607b4 c.Fatal won't fail and exit test inside a goroutine, errors should be handled outside with a channel
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 4203230cbbf46238e38099c9073bdcad5f69a63f
Component: engine
2015-04-29 17:02:22 +02:00
ae74d9f34f trivial: typo cleanup
Signed-off-by: David Mackey <tdmackey@booleanhaiku.com>
Upstream-commit: 3941623fbc3fa724d61f53121513ffd87d03b61c
Component: engine
2015-04-27 13:35:08 -07:00
c48fdf0abd Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a9688cdca5577d6db65d76f38bcbe4c1e6f5994f
Component: engine
2015-04-24 10:37:21 -07:00
dd4b0467ca Remove deleteAllContainers call in test
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: ee7a7b07e752c56bbe1b941feb1e4313275d68c2
Component: engine
2015-04-23 16:32:50 +02:00
1884ef3b9b Use suite for integration-cli
It prints test name and duration for each test.
Also performs deleteAllContainers after each test.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: dc944ea7e48d11a2906e751d3e61daf08faee054
Component: engine
2015-04-21 10:28:52 -07:00