summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md150
-rw-r--r--changelog.txt372
-rw-r--r--cmd/podman/containers/ps.go8
-rw-r--r--docs/source/markdown/podman-pod-ps.1.md24
-rw-r--r--docs/source/markdown/podman-ps.1.md8
-rwxr-xr-xhack/release.sh2
-rw-r--r--libpod/filters/containers.go163
-rw-r--r--libpod/filters/pods.go97
-rw-r--r--pkg/api/handlers/compat/containers_prune.go14
-rw-r--r--pkg/api/handlers/compat/networks.go37
-rw-r--r--pkg/api/handlers/utils/pods.go14
-rw-r--r--pkg/domain/infra/abi/containers.go12
-rw-r--r--pkg/domain/infra/abi/network.go2
-rw-r--r--pkg/domain/infra/abi/pods.go17
-rw-r--r--pkg/ps/ps.go16
-rw-r--r--pkg/util/utils.go12
-rw-r--r--test/e2e/checkpoint_test.go3
-rw-r--r--test/e2e/containers_conf_test.go17
-rw-r--r--test/e2e/cp_test.go3
-rw-r--r--test/e2e/image_sign_test.go3
-rw-r--r--test/e2e/import_test.go3
-rw-r--r--test/e2e/mount_rootless_test.go7
-rw-r--r--test/e2e/mount_test.go3
-rw-r--r--test/e2e/pod_ps_test.go26
-rw-r--r--test/e2e/ps_test.go122
-rw-r--r--test/e2e/push_test.go11
-rw-r--r--test/e2e/run_cgroup_parent_test.go2
-rw-r--r--test/e2e/run_signal_test.go4
-rw-r--r--test/e2e/trust_test.go3
-rw-r--r--troubleshooting.md2
-rw-r--r--version/version.go2
31 files changed, 958 insertions, 201 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index cabfafabb..f4df37a0e 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,155 @@
# Release Notes
+## 2.2.0
+### Features
+- Experimental support for shortname aliasing has been added. This is not enabled by default, but can be turned on by setting the environment variable `CONTAINERS_SHORT_NAME_ALIASING` to `on`. Documentation is [available here](https://github.com/containers/image/blob/master/docs/containers-registries.conf.5.md#short-name-aliasing).
+- The `podman generate kube` command now features support for exporting container's memory and CPU limits ([#7855](https://github.com/containers/podman/issues/7855)).
+- The `podman play kube` command now features support for setting CPU and Memory limits for containers ([#7742](https://github.com/containers/podman/issues/7742)).
+- The `podman play kube` command now supports Kubernetes configmaps via the `--configmap` option ([#7567](https://github.com/containers/podman/issues/7567)).
+- The `podman play kube` command now supports a `--log-driver` option to set the log driver for created containers.
+- The `podman play kube` command now supports a `--start` option, enabled by default, to start the pod after creating it. This allows for `podman play kube` to be more easily used in systemd unitfiles.
+- The `podman run` command now supports the `--network-alias` option to set network aliases (additional names the container can be accessed at from other containers via DNS if the `dnsname` CNI plugin is in use). Please note that this requires a new release (v1.1.0) of the `dnsname` plugin, and will only work on newly-created CNI networks.
+- The `podman network create` command now supports the `--ipv6` option to enable dual-stack IPv6 networking for created networks ([#7302](https://github.com/containers/podman/issues/7302)).
+- The `podman inspect` command can now inspect pods, networks, and volumes, in addition to containers and images ([#6757](https://github.com/containers/podman/issues/6757)).
+- The `--mount` option for `podman run` and `podman create` now supports a new type, `image`, to mount the contents of an image into the container at a given location.
+- The Bash and ZSH completions have been completely reworked and have received significant enhancements! Additionally, support for Fish completions and completions for the `podman-remote` executable have been added.
+- The `--log-opt` option for `podman create` and `podman run` now supports the `max-size` option to set the maximum size for a container's logs ([#7434](https://github.com/containers/podman/issues/7434)).
+- The `--network` option to the `podman pod create` command now allows pods to be configured to use `slirp4netns` networking, even when run as root ([#6097](https://github.com/containers/podman/issues/6097)).
+- The `podman pod stop`, `podman pod pause`, `podman pod unpause`, and `podman pod kill` commands now work on multiple containers in parallel and should be significantly faster.
+- The `podman search` command now supports a `--list-tags` option to list all available tags for a single image in a single repository.
+- The `podman search` command can now output JSON using the `--format=json` option.
+- The `podman diff` and `podman mount` commands now work with all containers in the storage library, including those not created by Podman. This allows them to be used with Buildah and CRI-O containers.
+- The `podman container exists` command now features a `--external` option to check if a container exists not just in Podman, but also in the storage library. This will allow Podman to identify Buildah and CRI-O containers.
+- The `--tls-verify` and `--authfile` options have been enabled for use with remote Podman.
+- The `/etc/hosts` file now includes the container's name and hostname (both pointing to localhost) when the container is run with `--net=none` ([#8095](https://github.com/containers/podman/issues/8095)).
+- The `podman events` command now supports filtering events based on the labels of the container they occurred on using the `--filter label=key=value` option.
+- The `podman volume ls` command now supports filtering volumes based on their labels using the `--filter label=key=value` option.
+- The `--volume` and `--mount` options to `podman run` and `podman create` now support two new mount propagation options, `unbindable` and `runbindable`.
+- The `name` filter for `podman pod ps` now matches based on a regular expression, instead of requiring an exact match.
+
+### Changes
+- The `podman network rm --force` command will now also remove pods that are using the network ([#7791](https://github.com/containers/podman/issues/7791)).
+- The `podman volume rm`, `podman network rm`, and `podman pod rm` commands now return exit code 1 if the object specified for removal does not exist, and exit code 2 if the object is in use and the `--force` option was not given.
+- If `/dev/fuse` is passed into Podman containers as a device, Podman will open it before starting the container to ensure that the kernel module is loaded on the host and the device is usable in the container.
+- Global Podman options that were not supported with remote operation have been removed from `podman-remote` (e.g. `--cgroup-manager`, `--storage-driver`).
+- Many errors have been changed to remove repetition and be more clear as to what has gone wrong.
+- The `--storage` option to `podman rm` is now enabled by default, with slightly changed semantics. If the given container does not exist in Podman but does exist in the storage library, it will be removed even without the `--storage` option. If the container exists in Podman it will be removed normally. The `--storage` option for `podman rm` is now deprecated and will be removed in a future release.
+- The `--storage` option to `podman ps` has been renamed to `--external`. An alias has been added so the old form of the option will continue to work.
+- Podman now delays the SIGTERM and SIGINT signals during container creation to ensure that Podman is not stopped midway through creating a container resulting in potential resource leakage ([#7941](https://github.com/containers/podman/issues/7941)).
+- The `podman save` command now strips signatures from images it is exporting, as the formats we export to do not support signatures ([#7659](https://github.com/containers/podman/issues/7659)).
+- A new `Degraded` state has been added to pods. Pods that have some, but not all, of their containers running are now considered to be `Degraded` instead of `Running`.
+
+### Bugfixes
+- Fixed a bug where `podman load` on the remote client did not error when attempting to load a directory, which is not yet supported for remote use.
+- Fixed a bug where rootless Podman could hang when the `newuidmap` binary was not installed ([#7776](https://github.com/containers/podman/issues/7776)).
+- Fixed a bug where the `--pull` option to `podman run`, `podman create`, and `podman build` did not match Docker's behavior.
+- Fixed a bug where sysctl settings from the `containers.conf` configuration file were applied, even if the container did not join the namespace associated with a sysctl.
+- Fixed a bug where Podman would not return the text of errors encounted when trying to run a healthcheck for a container.
+- Fixed a bug where Podman was accidentally setting the `containers` environment variable in addition to the expected `container` environment variable.
+- Fixed a bug where rootless Podman using CNI networking did not properly clean up DNS entries for removed containers ([#7789](https://github.com/containers/podman/issues/7789)).
+- Fixed a bug where the `podman untag --all` command was not supported with remote Podman.
+- Fixed a bug where the `podman system service` command could time out even if active attach connections were present ([#7826](https://github.com/containers/podman/issues/7826)).
+- Fixed a bug where the `podman system service` command would sometimes never time out despite no active connections being present.
+- Fixed a bug where Podman's handling of capabilities, specifically inheritable, did not match Docker's.
+- Fixed a bug where `podman run` would fail if the image specified was a manifest list and had already been pulled ([#7798](https://github.com/containers/podman/pull/7798)).
+- Fixed a bug where Podman did not take search registries into account when looking up images locally ([#6381](https://github.com/containers/podman/issues/6381)).
+- Fixed a bug where the `podman manifest inspect` command would fail for images that had already been pulled ([#7726](https://github.com/containers/podman/issues/7726)).
+- Fixed a bug where rootless Podman would not add supplemental GIDs to containers when when a user, but not a group, was set via the `--user` option to `podman create` and `podman run` and sufficient GIDs were available to add the groups ([#7782](https://github.com/containers/podman/issues/7782)).
+- Fixed a bug where remote Podman commands did not properly handle cases where the user gave a name that could also be a short ID for a pod or container ([#7837](https://github.com/containers/podman/issues/7837)).
+- Fixed a bug where `podman image prune` could leave images ready to be pruned after `podman image prune` was run ([#7872](https://github.com/containers/podman/issues/7872)).
+- Fixed a bug where the `podman logs` command with the `journald` log driver would not read all available logs ([#7476](https://github.com/containers/podman/issues/7476)).
+- Fixed a bug where the `--rm` and `--restart` options to `podman create` and `podman run` did not conflict when a restart policy that is not `on-failure` was chosen ([#7878](https://github.com/containers/podman/issues/7878)).
+- Fixed a bug where the `--format "table {{ .Field }}"` option to numerous Podman commands ceased to function on Podman v2.0 and up.
+- Fixed a bug where pods did not properly share an SELinux label between their containers, resulting in containers being unable to see the processes of other containers when the pod shared a PID namespace ([#7886](https://github.com/containers/podman/issues/7886)).
+- Fixed a bug where the `--namespace` option to `podman ps` did not work with the remote client ([#7903](https://github.com/containers/podman/issues/7903)).
+- Fixed a bug where rootless Podman incorrectly calculated the number of UIDs available in the container if multiple different ranges of UIDs were specified.
+- Fixed a bug where the `/etc/hosts` file would not be correctly populated for containers in a user namespace ([#7490](https://github.com/containers/podman/issues/7490)).
+- Fixed a bug where the `podman network create` and `podman network remove` commands could race when run in parallel, with unpredictable results ([#7807](https://github.com/containers/podman/issues/7807)).
+- Fixed a bug where the `-p` option to `podman run`, `podman create`, and `podman pod create` would, when given only a single number (e.g. `-p 80`), assign the same port for both host and container, instead of generating a random host port ([#7947](https://github.com/containers/podman/issues/7947)).
+- Fixed a bug where Podman containers did not properly store the cgroup manager they were created with, causing them to stop functioning after the cgroup manager was changed in `containers.conf` or with the `--cgroup-manager` option ([#7830](https://github.com/containers/podman/issues/7830)).
+- Fixed a bug where the `podman inspect` command did not include information on the CNI networks a container was connected to if it was not running.
+- Fixed a bug where the `podman attach` command would not print a newline after detaching from the container ([#7751](https://github.com/containers/podman/issues/7751)).
+- Fixed a bug where the `HOME` environment variable was not set properly in containers when the `--userns=keep-id` option was set ([#8004](https://github.com/containers/podman/issues/8004)).
+- Fixed a bug where the `podman container restore` command could panic when the container in question was in a pod ([#8026](https://github.com/containers/podman/issues/8026)).
+- Fixed a bug where the output of the `podman image trust show --raw` command was not properly formatted.
+- Fixed a bug where the `podman runlabel` command could panic if a label to run was not given ([#8038](https://github.com/containers/podman/issues/8038)).
+- Fixed a bug where the `podman run` and `podman start --attach` commands would exit with an error when the user detached manually using the detach keys on remote Podman ([#7979](https://github.com/containers/podman/issues/7979)).
+- Fixed a bug where rootless CNI networking did not use the `dnsname` CNI plugin if it was not available on the host, despite it always being available in the container used for rootless networking ([#8040](https://github.com/containers/podman/issues/8040)).
+- Fixed a bug where Podman did not properly handle cases where an OCI runtime is specified by its full path, and could revert to using another OCI runtime with the same binary path that existed in the system `$PATH` on subsequent invocations.
+- Fixed a bug where the `--net=host` option to `podman create` and `podman run` would cause the `/etc/hosts` file to be incorrectly populated ([#8054](https://github.com/containers/podman/issues/8054)).
+- Fixed a bug where the `podman inspect` command did not include container network information when the container shared its network namespace (IE, joined a pod or another container's network namespace via `--net=container:...`) ([#8073](https://github.com/containers/podman/issues/8073)).
+- Fixed a bug where the `podman ps` command did not include information on all ports a container was publishing.
+- Fixed a bug where the `podman build` command incorrectly forwarded `STDIN` into build containers from `RUN` instructions.
+- Fixed a bug where the `podman wait` command's `--interval` option did not work when units were not specified for the duration ([#8088](https://github.com/containers/podman/issues/8088)).
+- Fixed a bug where the `--detach-keys` and `--detach` options could be passed to `podman create` despite having no effect (and not making sense in that context).
+- Fixed a bug where Podman could not start containers if running on a system without a `/etc/resolv.conf` file (which occurs on some WSL2 images) ([#8089](https://github.com/containers/podman/issues/8089)).
+- Fixed a bug where the `--extract` option to `podman cp` was nonfunctional.
+- Fixed a bug where the `--cidfile` option to `podman run` would, when the container was not run with `--detach`, only create the file after the container exited ([#8091](https://github.com/containers/podman/issues/8091)).
+- Fixed a bug where the `podman images` and `podman images -a` commands could panic and not list any images when certain improperly-formatted images were present in storage ([#8148](https://github.com/containers/podman/issues/8148)).
+- Fixed a bug where the `podman events` command could, when the `journald` events backend was in use, become nonfunctional when a badly-formatted event or a log message that container certain string was present in the journal ([#8125](https://github.com/containers/podman/issues/8125)).
+- Fixed a bug where remote Podman would, when using SSH transport, not authenticate to the server using hostkeys when connecting on a port other than 22 ([#8139](https://github.com/containers/podman/issues/8139)).
+- Fixed a bug where the `podman attach` command would not exit when containers stopped ([#8154](https://github.com/containers/podman/issues/8154)).
+- Fixed a bug where Podman did not properly clean paths before verifying them, resulting in Podman refusing to start if the root or temporary directories were specified with extra trailing `/` characters ([#8160](https://github.com/containers/podman/issues/8160)).
+- Fixed a bug where remote Podman did not support hashed hostnames in the `known_hosts` file on the host for establishing connections ([#8159](https://github.com/containers/podman/pull/8159)).
+- Fixed a bug where the `podman image exists` command would return non-zero (false) when multiple potential matches for the given name existed.
+- Fixed a bug where the `podman manifest inspect` command on images that are not manifest lists would error instead of inspecting the image ([#8023](https://github.com/containers/podman/issues/8023)).
+- Fixed a bug where the `podman system service` command would fail if the directory the Unix socket was to be created inside did not exist ([#8184](https://github.com/containers/podman/issues/8184)).
+- Fixed a bug where pods that shared the IPC namespace (which is done by default) did not share a `/dev/shm` filesystem between all containers in the pod ([#8181](https://github.com/containers/podman/issues/8181)).
+- Fixed a bug where filters passed to `podman volume list` were not inclusive ([#6765](https://github.com/containers/podman/issues/6765)).
+- Fixed a bug where the `podman volume create` command would fail when the volume's data directory already existed (as might occur when a volume was not completely removed) ([#8253](https://github.com/containers/podman/issues/8253)).
+- Fixed a bug where the `podman run` and `podman create` commands would deadlock when trying to create a container that mounted the same named volume at multiple locations (e.g. `podman run -v testvol:/test1 -v testvol:/test2`) ([#8221](https://github.com/containers/podman/issues/8221)).
+- Fixed a bug where the parsing of the `--net` option to `podman build` was incorrect ([#8322](https://github.com/containers/podman/issues/8322)).
+- Fixed a bug where the `podman build` command would print the ID of the built image twice when using remote Podman ([#8332](https://github.com/containers/podman/issues/8332)).
+- Fixed a bug where the `podman stats` command did not show memory limits for containers ([#8265](https://github.com/containers/podman/issues/8265)).
+- Fixed a bug where the `podman pod inspect` command printed the static MAC address of the pod in a non-human-readable format ([#8386](https://github.com/containers/podman/pull/8386)).
+- Fixed a bug where the `--tls-verify` option of the `podman play kube` command had its logic inverted (`false` would enforce the use of TLS, `true` would disable it).
+
+### API
+- The Compat Create endpoint for Container has received a major refactor to share more code with the Libpod Create endpoint, and should be significantly more stable.
+- A Compat endpoint for exporting multiple images at once, `GET /images/get`, has been added ([#7950](https://github.com/containers/podman/issues/7950)).
+- The Compat Network Connect and Network Disconnect endpoints have been added.
+- Endpoints that deal with image registries now support a `X-Registry-Config` header to specify registry authentication configuration.
+- The Compat Create endpoint for images now properly supports specifying images by digest.
+- The Libpod Build endpoint for images now supports an `httpproxy` query parameter which, if set to true, will forward the server's HTTP proxy settings into the build container for `RUN` instructions.
+- The Libpod Untag endpoint for images will now remove all tags for the given image if no repository and tag are specified for removal.
+- Fixed a bug where the Compat Logs endpoint for containers did not send a newline character after each log line.
+- Fixed a bug where the Compat Logs endpoint for containers would mangle line endings to change newline characters to add a preceding carriage return ([#7942](https://github.com/containers/podman/issues/7942)).
+- Fixed a bug where the Compat Inspect endpoint for Containers did not properly list the container's stop signal ([#7917](https://github.com/containers/podman/issues/7917)).
+- Fixed a bug where the Compat Inspect endpoint for Containers formatted the container's create time incorrectly ([#7860](https://github.com/containers/podman/issues/7860)).
+- Fixed a bug where the Compat Inspect endpoint for Containers did not include complete network information on the container.
+- Fixed a bug where the server could panic if a client closed a connection midway through an image pull ([#7896](https://github.com/containers/podman/issues/7896)).
+- Fixed a bug where the Compat Create endpoint for volumes returned an error when a volume with the same name already existed, instead of succeeding with a 201 code ([#7740](https://github.com/containers/podman/issues/7740)).
+- Fixed a bug where a client disconnecting from the Libpod or Compat events endpoints could result in the server using 100% CPU ([#7946](https://github.com/containers/podman/issues/7946)).
+- Fixed a bug where the "no such image" error message sent by the Compat Inspect endpoint for Images returned a 404 status code with an error that was improperly formatted for Docker compatibility.
+- Fixed a bug where the Compat Create endpoint for networks did not properly set a default for the `driver` parameter if it was not provided by the client.
+- Fixed a bug where the Compat Inspect endpoint for images did not populate the `RootFS` field of the response.
+
+### Misc
+- Updated Buildah to v1.18.0
+- Updated the containers/storage library to v1.24.0
+- Updated the containers/image library to v5.8.0
+- Updated the containers/common library to v0.27.0
+
+## 2.1.1
+### Changes
+- The `podman info` command now includes the cgroup manager Podman is using.
+
+### Bugfixes
+- Fixed a bug where Podman would not build with the `varlink` build tag enabled.
+- Fixed a bug where the `podman save` command could, when asked to save multiple images, write its progress bar to the archive instead of the terminal, producing a corrupted archive.
+- Fixed a bug where the `json-file` log driver did not write logs.
+- Fixed a bug where `podman-remote start --attach` did not properly handle detaching using the detach keys.
+- Fixed a bug where `podman pod ps --filter label=...` did not work.
+- Fixed a bug where the `podman build` command did not respect the `--runtime` flag.
+
+### API
+- The REST API now includes a Server header in all responses.
+- Fixed a bug where the Libpod and Compat Attach endpoints could terminate early, before sending all output from the container.
+- Fixed a bug where the Compat Create endpoint for containers did not properly handle the Interactive parameter.
+- Fixed a bug where the Compat Kill endpoint for containers could continue to run after a fatal error.
+- Fixed a bug where the Limit parameter of the Compat List endpoint for Containers did not properly handle a limit of 0 (returning nothing, instead of all containers) ([#7722](https://github.com/containers/podman/issues/7722)).
+- The Libpod Stats endpoint for containers is being deprecated and will be replaced by a similar endpoint with additional features in a future release.
+
## 2.1.0
### Features
- A new command, `podman image mount`, has been added. This allows for an image to be mounted, read-only, to inspect its contents without creating a container from it ([#1433](https://github.com/containers/podman/issues/1433)).
diff --git a/changelog.txt b/changelog.txt
index 0ec721996..4d423ca44 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,375 @@
+- Changelog for v2.2.0-rc1 (2020-11-18):
+ * Add release notes for v2.2.0-RC1
+ * correct numbering typo
+ * Align the podman ps --filter behavior with docker
+ * Fix podman pod inspect show wrong MAC string
+ * Fix example for manifest push
+ * add network connect|disconnect compat endpoints
+ * Rename e2e test files to include _test.go suffix
+ * Client call to /play/kube incorrectly set tlsVerify
+ * Add an option to control if play kube should start the pod
+ * Swap out json-iterator for golang default
+ * Fix missing headers in `network ls`
+ * [CI:DOCS] fix an apostrophe nit in man page
+ * remove contrib/gate
+ * Remove some more excessive wrapping and stuttering
+ * Cleanup tutorials
+ * use container cgroups path
+ * Explain the relation between --pod and --network
+ * Make sure /etc/hosts populated correctly with networks
+ * logformatter: highlight timing results
+ * Bump Buildah to v1.18.0, c/storage to v1.24.0
+ * Cirrus: Invalidate static cache on VM image update
+ * Improve the shell completion api
+ * use lookaside storage for remote tests
+ * Bump k8s.io/apimachinery from 0.19.3 to 0.19.4
+ * Wrap missing container errors with container ID
+ * system tests: various
+ * Add support for volume ls --filter label=key=value
+ * Podman-remote build is getting ID twice
+ * [CI:DOCS] Touch up Podman description in man page menu
+ * Fix markdown tables on docs.podman.io
+ * short-name aliasing
+ * Set podman-auto-update.service Type=oneshot
+ * test for buildah version in container images.
+ * Add missing --now in systemctl start command
+ * Change podman build --pull=true to PullIfMissing
+ * Fix namespace flag parsing for podman build
+ * Add podman build --net alias for --network
+ * Refactor to use DockerClient vs APIClient
+ * Maintain consistent order of short and long flag names in docs
+ * Fix issues found with codespell
+ * Bump github.com/rootless-containers/rootlesskit from 0.11.0 to 0.11.1
+ * Install the new shell completion logic
+ * Add shell completion with cobra
+ * Vendor in some cobra PRs to improve the completion experience.
+ * Add support for network connect / disconnect to DB
+ * Ensure we do not double-lock the same volume in create
+ * Cleanup error reporting
+ * Cirrus: update VMs
+ * [CI:DOCS] Restore man page cross-checker
+ * Cirrus: Run validation tests in CI:DOCS mode
+ * Add podman(1) to the list of man pages on docs.podman.io
+ * Set default network driver for APIv2 networks
+ * Add tests to make sure podman-remote logs works correctly.
+ * Add anchors for flag names on docs.podman.io
+ * migrate play kube to spec gen
+ * Add example of fuse-overlay to podman system reset
+ * Bump github.com/containers/common from 0.26.3 to 0.27.0
+ * skip ipv6 e2e tests on rootless
+ * add e2e test for network with same subnet
+ * enable ipv6 network configuration options
+ * make network name uniq for dnsname tests
+ * network aliases for container creation
+ * system tests: skip journald tests on RHEL8
+ * Update podman build man page to match buildah bud man page
+ * Cirrus: Detailed CPU/Memory/Time runner.sh stats
+ * podman-pull.1.md: add example for pulling an image by hash
+ * podman-import.1.md: fix paragraph formatting
+ * podman-import.1.md: fix shell syntax
+ * Update CI tests to run python docker library against API
+ * Stop binding layer from changing line endings
+ * Add support for podman search --format json
+ * Add --log-driver to play kube
+ * Show error on bad name filter in podman ps
+ * Use CPP, CC and flags in dep check scripts
+ * Fix link to point at correct content
+ * fix: allow volume creation when the _data directory already exists
+ * rootless container creation settings
+ * fix: podman-system-service doc time is seconds
+ * Bump github.com/rootless-containers/rootlesskit from 0.10.1 to 0.11.0
+ * Update nix pin with `make nixpkgs`
+ * Use /tmp/podman-run-* for backup XDG_RUNTIME_DIR
+ * Only use container/storage/pkg/homedir.Get()
+ * Add support for mounting external containers
+ * Cirrus: Use F33beta VM image
+ * Cirrus: Simplify artifact collection
+ * Use ping from alpine
+ * Bump github.com/containers/storage from 1.23.8 to 1.23.9
+ * add a PR template
+ * Use regex for "pod ps" name filter to match "ps" behavior
+ * Add tip re. typical root cause of "Exec format error" to troubleshooting.md
+ * Add tests for network aliases
+ * Make volume filters inclusive
+ * [CI:DOCS]Add Urvashi to podman OWNERS
+ * Improve error messages from failing tests
+ * fedora rootless cpu settings
+ * Test $HOME when it's parent is bind mounted with --userns=keep-id
+ * Update README.md
+ * docs: Mention mounts.conf location for non-root users
+ * Add test/apiv2/rest_api tests to make target
+ * specgen: keep capabilities with --userns=keep-id
+ * specgen: fix check for root user
+ * specgen: add support for ambient capabilities
+ * Add better support for unbindable volume mounts
+ * Bump github.com/containers/storage from 1.23.7 to 1.23.8
+ * Use osusergo build tag for static build
+ * Change http ConnState actions between new and active
+ * Match build pull functionality with Docker's
+ * Centralize cores and period/quota conversion code
+ * specgen, cgroup2: check whether memory swap is enabled
+ * Fix dnsname when joining a different network namespace in a pod
+ * Bump Buildah to v1.17.0
+ * manifest list inspect single image
+ * Remove search limit since pagination support
+ * spec: protect against segfault
+ * [CI:DOCS] Fix broken CI readme links
+ * Improve setupSystemd, grab mount options from the host
+ * specgen: split cgroup v1 and cgroup v2 code
+ * specgen: fix error message
+ * When container stops, drop sig-proxy errors to infos
+ * Cirrus: Workaround F32 BFQ Kernel bug
+ * Stop excessive wrapping of errors
+ * Pod's that share the IPC Namespace need to share /dev/shm
+ * Fix the `--pull` flag to `podman build` to match Docker
+ * Restore --format table header support
+ * Create the default root API address path
+ * new "image" mount type
+ * Cirrus: Simplify setting/passing env. vars.
+ * Podman often reports OCI Runtime does not exist, even if it does
+ * rootless: improve error message if cannot join namespaces
+ * NewFromLocal can return multiple images
+ * libpod: clean paths before check
+ * move from docker.io
+ * Cirrus: Use google mirror for docker.io
+ * Cirrus: Always record runc/crun versions
+ * Ensure that attach ready channel does not block
+ * Add a way to retrieve all network aliases for a ctr
+ * Add pod, volume, network to inspect package
+ * Add network aliases for containers to DB
+ * Add test cases to cover podman volume
+ * Document how to enable CPU limit delegation
+ * Add more details about how CPU limits work
+ * set resources only when specified
+ * Improve the journal event reading
+ * build(deps): bump github.com/containers/common from 0.26.0 to 0.26.3
+ * Support hashed hostnames in the known_hosts file
+ * image list: check for all errors
+ * Yet another iteration on PR title plugin
+ * System tests: cleanup, make more robust
+ * pr update action: fix errors on master branch
+ * The cidfile should be created when the container is created
+ * auto update: mark it as non-experimental
+ * Add support for host keys for non-22 ports
+ * fix: podman-cp respects "--extract" flag
+ * add GitHub action to add non-main branch to PR title
+ * filter events by labels
+ * Bump github.com/spf13/cobra from 1.1.0 to 1.1.1
+ * Bump github.com/containers/buildah from 1.16.4 to 1.16.5
+ * src: nil check
+ * Don't error if resolv.conf does not exists
+ * src: add nil checks
+ * replace net_raw with setuid
+ * fix: /image/{name}/json returns RootFS layers
+ * APIv2 compatibility network connect|disconnect
+ * Tests: Check different log driver can work with podman logs
+ * podman create doesn't support creating detached containers
+ * Fix pull method selection
+ * set compat network driver default
+ * Add hostname to /etc/hosts for --net=none
+ * Add a Degraded state to pods
+ * Refactor podman to use c/common/pkg/report
+ * container create: record correct image name
+ * Add EOL to compat container logs
+ * save image remove signatures
+ * Switch use of Flags to Options
+ * Bump k8s.io/apimachinery from 0.19.2 to 0.19.3
+ * Fix handling and documentation of podman wait --interval
+ * Podman build should default to not usins stdin
+ * Tests: Fix common flakes, and improve apiv2 test log
+ * Retrieve network inspect info from dependency container
+ * refactor api compatibility container creation to specgen
+ * Fix ps port output
+ * Ensure that hostname is added to hosts with net=host
+ * Add a system test to verify --runtime is preserved
+ * Use runtime names instead of paths in E2E tests
+ * Re-create OCI runtimes by path when it is missing
+ * When given OCI runtime by path, use path as name
+ * fix: neutral value for MemorySwappiness
+ * Make invalid image name error more specific
+ * System tests: remove some misleading 'run's
+ * --tls-verify and --authfile should work for all remote commands
+ * Fix host to container port mapping for simple ranges
+ * Always add the dnsname plugin to the config for rootless
+ * Make man page headings more consistent
+ * Update podman-remote start --attach to handle detach keys
+ * Update podman-remote run to handle detach keys
+ * Bump github.com/containers/common from 0.24.0 to 0.26.0
+ * Fix panic when runlabel is missing
+ * Fix podman image trust show --raw output
+ * Fix podman-run man page heading
+ * Fix sorting issues in completions
+ * Add support for external container
+ * fix podman container exists and diff for storage containers
+ * Fix possible panic in libpod container restore
+ * Bump github.com/spf13/cobra from 1.0.0 to 1.1.0
+ * System test additions
+ * Setup HOME environment when using --userns=keep-id
+ * Setup HOME environment when using --userns=keep-id
+ * Fix indentation for `podman pod inspect`
+ * Cirrus: Execute docker-py tests on a VM
+ * Restore --format table support
+ * Convert Split() calls with an equal sign to SplitN()
+ * Bump github.com/onsi/gomega from 1.10.2 to 1.10.3
+ * Restore indent on JSON from `podman inspect`
+ * Enforce LIFO ordering for shutdown handlers
+ * alter compat no such image message
+ * Cirrus: Restore APIv2 Testing
+ * Cirrus: Ability to skip most tests for docs updates
+ * Restore --format: stats & pod ps
+ * Enable masking stop signals within container creation
+ * APIv2 tests: try again to fix them
+ * Add a shutdown handler package
+ * System tests: run with local podman, not remote
+ * Remove a note that the HTTP API is not yet stable.
+ * APIv2 tests: get them passing again
+ * Add support for resource limits to play kube
+ * Resolve #7860 - add time.RFC3339Nano into ContainerJSONBase
+ * Add more APIv2 tests for images: push, tag, untag, rmi and image tree.
+ * Include CNI networks in inspect output when not running
+ * Monitor for client closing stream
+ * pkg/spec: fix a confusing error message
+ * Search repository tags using --list-tags
+ * Fix the "err: cause" order of OCI runtime errors
+ * tests/e2e: Add Toolbox-specific test cases
+ * This PR allows users to remove external containers directly
+ * Fix documentation link and typo
+ * Restore --format table...
+ * Add support for resource cpu limit to generate kube
+ * Port V1 --format table to V2 podman
+ * BlobInfoCacheDir is set incorrectly when copying images
+ * Store cgroup manager on a per-container basis
+ * --format updates for images/diff.go
+ * add compatibility endpoint for exporting multiple images
+ * Restore --format 'table...' to commands
+ * Ports given only by number should have random host port
+ * Update nix pin with `make nixpkgs`
+ * add prerequisite section before building binaries
+ * newlines on all container detaches
+ * Cirrus: Fix obtaining a CI VM
+ * APIv2 compatibility rootless network fix
+ * Port commands to V2 --format 'table...'
+ * system tests: cleanup, and add more tests
+ * prevent unpredictable results with network create|remove
+ * Enable k8s configmaps as flags for play kube
+ * Attempt to turn on some more remote tests
+ * Use WaitWithDefaultTimeout in cleanup
+ * Move pod jobs to parallel execution
+ * Populate /etc/hosts file when run in a user namespace
+ * Cirrus: Fix running shellcheck locally
+ * Cirrus CI runner: refactor
+ * fix apiv2 /containers/$name/json return wrong value in `.Config.StopSignal`
+ * pkg/cgroups/createCgroupv2Path: nits
+ * Lowercase some errors
+ * Remove excessive error wrapping
+ * Support max_size logoptions
+ * Fixes remote attach and exec to signal IdleTracker
+ * Cirrus: Skip deep testing on branches
+ * logformatter: run on system tests & bindings
+ * Fix handling of CheckRootlessUIDRange
+ * Cirrus: Fix branch-validation failure
+ * Add TODO for adding CPU limit support
+ * Add support for resource memory limit to generate kube
+ * Fix podman-remote ps --ns broken
+ * fix closed the remote connection on pull causes service panic
+ * Add SELinux support for pods
+ * Cirrus: Implement podman automation 2.0
+ * compat: images/create: fix tag parsing
+ * Fix Podman logs reading journald
+ * Restore "table" --format from V1
+ * --rm option shold conflicts with --restart
+ * Bump github.com/containers/common from 0.23.0 to 0.24.0
+ * libpod: check the gid is present before adding it
+ * podman-remote does not support most of the global flags
+ * Correct to latest version
+ * Bump github.com/containers/buildah from 1.16.2 to 1.16.4
+ * image prune: remove all candidates
+ * spec: open fuse with --device .*/fuse
+ * rootless: use sync.Once for GetAvailableGids()
+ * rootless: move GetAvailableGids to the rootless pkg
+ * logformatter: add Synopsis at top of each page
+ * Podman containers/pods prune should throw an error if user adds args
+ * fix compat api privileged and entrypoint code
+ * Migrate container images to automation_images
+ * system test: untag all test
+ * remote: fix name and ID collisions of containers and pods
+ * Add additionalGIDs from users in rootless mode
+ * Fix some flakes in the e2e network tests.
+ * Update rootless_tutorial.md
+ * Volume prune should not pass down the force flag
+ * Support --http-proxy for remote builds
+ * fix: The container created by APIV2 has an incorrect Env and WorkDir
+ * misc fixes for f33 integration tests
+ * fix allowing inspect manifest of non-local image
+ * Distinguish userns vs containerized tests
+ * Don't disable Go modules when generating varlink
+ * Use local image if input image is a manifest list
+ * image look up: consult registries.conf
+ * pkg/registries: add a retiring note
+ * Attempt to test all Broken SkipIfRootless FIXME
+ * Make the e2e test network cleanup more robust.
+ * Fix ubuntu exec_test
+ * capabilities: always set ambient and inheritable
+ * libpod: bump up rootless-cni-infra to v3
+ * rootless-cni-infra v3: fix cleaning up DNS entries
+ * fix remote untag
+ * Make all Skips specify a reason
+ * Fix handling of remove of bogus volumes, networks and Pods
+ * We already set container=podman environment variable
+ * Refactor IdleTracker to handle StateIdle transitions
+ * System tests: add podman run --tz
+ * System tests: corner case for run --pull
+ * healthchecks: return systemd-run error
+ * Add X-Registry-Config support
+ * Gating-test fix: deal with new crun error msg
+ * Bump github.com/sirupsen/logrus from 1.6.0 to 1.7.0
+ * Apply suggestions from code review
+ * Adds missing . to README.md file.
+ * Ignore containers.conf sysctl when namespaces set to host
+ * System tests: reenable some skipped tests
+ * Journald log driver test
+ * fix for compatibility volume creation
+ * Add section about current differences
+ * Fix network remove for the podman remote client
+ * Fix podman network rm --force when network is used by a pod
+ * Remove SkipIfRootless if possible, document other calls
+ * Properly handle podman run --pull command
+ * Updating on supported restart policy
+ * Add support for slirp network for pods
+ * rootless: fix hang when newidmap is not installed
+ * Remove some SkipIfRootess flags from tests
+ * Bump github.com/containers/common from 0.22.0 to 0.23.0
+ * HTTP Attach: Wait until both STDIN and STDOUT finish
+ * build: honor --runtime setting
+ * remote load: check if input is directory
+ * stats: break out CLI options
+ * new endpoint: /libpod/containers/stats
+ * apiv2 container limit differ from docker-api
+ * system tests: helpers: safer parse_table
+ * system tests: new test for run --log-driver
+ * set interactive mode with compat create endpoint
+ * Allow filtering on pod label values
+ * Remove final v2remotefail failures
+ * Fix a bug where log-driver json-file was made no logs
+ * e2e tests: SkipIfRemote(): add a reason
+ * stats refactor
+ * Systemd should be able to run as rootless
+ * Bump github.com/containers/buildah from 1.16.1 to 1.16.2
+ * Examine all SkipIfRemote functions
+ * fix build with varlink
+ * Bump version in README to v2.1.0
+ * Include cgroup manager in `podman info` output
+ * Add Server header to API service responses
+ * Bump to v2.2.0-dev
+ * podman save: fix redirect of multi-images
+ * pkg/hooks: support all hooks
+ * Print nice error message when python is not installed
+ * add missing return for compat kill
+ * system tests: new tests
+ * Evict containers before removing via V2 API
+ * Cirrus: Add gpg2 to Ubuntu images
+ * Fix mismatch between log messages and behavior of libpod.LabelVolumePath.
+
- Changelog for v2.1.0 (2020-09-22):
* Update release notes for v2.1.0 Final Release
* Fix up attach tests for podman remote
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index a9e2d2e35..642feb5e0 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -98,14 +98,6 @@ func checkFlags(c *cobra.Command) error {
if listOpts.Last >= 0 && listOpts.Latest {
return errors.Errorf("last and latest are mutually exclusive")
}
- // Filter on status forces all
- for _, filter := range filters {
- splitFilter := strings.SplitN(filter, "=", 2)
- if strings.ToLower(splitFilter[0]) == "status" {
- listOpts.All = true
- break
- }
- }
// Quiet conflicts with size and namespace and is overridden by a Go
// template.
if listOpts.Quiet {
diff --git a/docs/source/markdown/podman-pod-ps.1.md b/docs/source/markdown/podman-pod-ps.1.md
index 94747cd10..e1d60d765 100644
--- a/docs/source/markdown/podman-pod-ps.1.md
+++ b/docs/source/markdown/podman-pod-ps.1.md
@@ -80,19 +80,23 @@ Default: created
#### **--filter**, **-f**=*filter*
-Filter output based on conditions given
+Filter output based on conditions given.
+Multiple filters can be given with multiple uses of the --filter flag.
+Filters with the same key work inclusive with the only exception being
+`label` which is exclusive. Filters with different keys always work exclusive.
Valid filters are listed below:
-| **Filter** | **Description** |
-| --------------- | ------------------------------------------------------------------- |
-| id | [ID] Pod's ID |
-| name | [Name] Pod's name |
-| label | [Key] or [Key=Value] Label assigned to a container |
-| ctr-names | Container name within the pod |
-| ctr-ids | Container ID within the pod |
-| ctr-status | Container status within the pod |
-| ctr-number | Number of containers in the pod |
+| **Filter** | **Description** |
+| ---------- | ------------------------------------------------------------------------------------- |
+| id | [ID] Pod's ID (accepts regex) |
+| name | [Name] Pod's name (accepts regex) |
+| label | [Key] or [Key=Value] Label assigned to a container |
+| status | Pod's status: `stopped`, `running`, `paused`, `exited`, `dead`, `created`, `degraded` |
+| ctr-names | Container name within the pod (accepts regex) |
+| ctr-ids | Container ID within the pod (accepts regex) |
+| ctr-status | Container status within the pod |
+| ctr-number | Number of containers in the pod |
#### **--help**, **-h**
diff --git a/docs/source/markdown/podman-ps.1.md b/docs/source/markdown/podman-ps.1.md
index 5869f2307..f542daf4c 100644
--- a/docs/source/markdown/podman-ps.1.md
+++ b/docs/source/markdown/podman-ps.1.md
@@ -44,15 +44,15 @@ Display external containers that are not controlled by Podman but are stored in
Filter what containers are shown in the output.
Multiple filters can be given with multiple uses of the --filter flag.
-If multiple filters are given, only containers which match all of the given filters will be shown.
-Results will be drawn from all containers, regardless of whether --all was given.
+Filters with the same key work inclusive with the only exception being
+`label` which is exclusive. Filters with different keys always work exclusive.
Valid filters are listed below:
| **Filter** | **Description** |
| --------------- | -------------------------------------------------------------------------------- |
-| id | [ID] Container's ID |
-| name | [Name] Container's name |
+| id | [ID] Container's ID (accepts regex) |
+| name | [Name] Container's name (accepts regex) |
| label | [Key] or [Key=Value] Label assigned to a container |
| exited | [Int] Container's exit code |
| status | [Status] Container's status: 'created', 'exited', 'paused', 'running', 'unknown' |
diff --git a/hack/release.sh b/hack/release.sh
index 56cd04079..e9eeaa73b 100755
--- a/hack/release.sh
+++ b/hack/release.sh
@@ -27,7 +27,7 @@ LAST_TAG=$(git describe --tags --abbrev=0)
write_go_version()
{
LOCAL_VERSION="$1"
- sed -i "s/^\(var Version = semver.MustParse\( \"\).*/\1${LOCAL_VERSION}\"\)/" version/version.go
+ sed -i "s/^\(var Version = semver.MustParse( *\"\).*/\1${LOCAL_VERSION}\")/" version/version.go
}
write_spec_version()
diff --git a/libpod/filters/containers.go b/libpod/filters/containers.go
index da1b5b263..2520c4f30 100644
--- a/libpod/filters/containers.go
+++ b/libpod/filters/containers.go
@@ -1,7 +1,6 @@
package lpfilters
import (
- "regexp"
"strconv"
"strings"
"time"
@@ -11,101 +10,133 @@ import (
"github.com/containers/podman/v2/pkg/timetype"
"github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
)
// GenerateContainerFilterFuncs return ContainerFilter functions based of filter.
-func GenerateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime) (func(container *libpod.Container) bool, error) {
+func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpod.Runtime) (func(container *libpod.Container) bool, error) {
switch filter {
case "id":
+ // we only have to match one ID
return func(c *libpod.Container) bool {
- return strings.Contains(c.ID(), filterValue)
+ return util.StringMatchRegexSlice(c.ID(), filterValues)
}, nil
case "label":
- var filterArray = strings.SplitN(filterValue, "=", 2)
- var filterKey = filterArray[0]
- if len(filterArray) > 1 {
- filterValue = filterArray[1]
- } else {
- filterValue = ""
- }
+ // we have to match that all given labels exits on that container
return func(c *libpod.Container) bool {
- for labelKey, labelValue := range c.Labels() {
- if labelKey == filterKey && ("" == filterValue || labelValue == filterValue) {
- return true
+ labels := c.Labels()
+ for _, filterValue := range filterValues {
+ matched := false
+ filterArray := strings.SplitN(filterValue, "=", 2)
+ filterKey := filterArray[0]
+ if len(filterArray) > 1 {
+ filterValue = filterArray[1]
+ } else {
+ filterValue = ""
+ }
+ for labelKey, labelValue := range labels {
+ if labelKey == filterKey && ("" == filterValue || labelValue == filterValue) {
+ matched = true
+ break
+ }
+ }
+ if !matched {
+ return false
}
}
- return false
+ return true
}, nil
case "name":
+ // we only have to match one name
return func(c *libpod.Container) bool {
- match, err := regexp.MatchString(filterValue, c.Name())
- if err != nil {
- logrus.Errorf("Failed to compile regex for 'name' filter: %v", err)
- return false
- }
- return match
+ return util.StringMatchRegexSlice(c.Name(), filterValues)
}, nil
case "exited":
- exitCode, err := strconv.ParseInt(filterValue, 10, 32)
- if err != nil {
- return nil, errors.Wrapf(err, "exited code out of range %q", filterValue)
+ var exitCodes []int32
+ for _, exitCode := range filterValues {
+ ec, err := strconv.ParseInt(exitCode, 10, 32)
+ if err != nil {
+ return nil, errors.Wrapf(err, "exited code out of range %q", ec)
+ }
+ exitCodes = append(exitCodes, int32(ec))
}
return func(c *libpod.Container) bool {
ec, exited, err := c.ExitCode()
- if ec == int32(exitCode) && err == nil && exited {
- return true
+ if err == nil && exited {
+ for _, exitCode := range exitCodes {
+ if ec == exitCode {
+ return true
+ }
+ }
}
return false
}, nil
case "status":
- if !util.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
- return nil, errors.Errorf("%s is not a valid status", filterValue)
+ for _, filterValue := range filterValues {
+ if !util.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
+ return nil, errors.Errorf("%s is not a valid status", filterValue)
+ }
}
return func(c *libpod.Container) bool {
status, err := c.State()
if err != nil {
return false
}
- if filterValue == "stopped" {
- filterValue = "exited"
- }
state := status.String()
if status == define.ContainerStateConfigured {
state = "created"
} else if status == define.ContainerStateStopped {
state = "exited"
}
- return state == filterValue
+ for _, filterValue := range filterValues {
+ if filterValue == "stopped" {
+ filterValue = "exited"
+ }
+ if state == filterValue {
+ return true
+ }
+ }
+ return false
}, nil
case "ancestor":
// This needs to refine to match docker
// - ancestor=(<image-name>[:tag]|<image-id>| ⟨image@digest⟩) - containers created from an image or a descendant.
return func(c *libpod.Container) bool {
- containerConfig := c.Config()
- if strings.Contains(containerConfig.RootfsImageID, filterValue) || strings.Contains(containerConfig.RootfsImageName, filterValue) {
- return true
+ for _, filterValue := range filterValues {
+ containerConfig := c.Config()
+ if strings.Contains(containerConfig.RootfsImageID, filterValue) || strings.Contains(containerConfig.RootfsImageName, filterValue) {
+ return true
+ }
}
return false
}, nil
case "before":
- ctr, err := r.LookupContainer(filterValue)
- if err != nil {
- return nil, errors.Errorf("unable to find container by name or id of %s", filterValue)
+ var createTime time.Time
+ for _, filterValue := range filterValues {
+ ctr, err := r.LookupContainer(filterValue)
+ if err != nil {
+ return nil, err
+ }
+ containerConfig := ctr.Config()
+ if createTime.IsZero() || createTime.After(containerConfig.CreatedTime) {
+ createTime = containerConfig.CreatedTime
+ }
}
- containerConfig := ctr.Config()
- createTime := containerConfig.CreatedTime
return func(c *libpod.Container) bool {
cc := c.Config()
return createTime.After(cc.CreatedTime)
}, nil
case "since":
- ctr, err := r.LookupContainer(filterValue)
- if err != nil {
- return nil, errors.Errorf("unable to find container by name or id of %s", filterValue)
+ var createTime time.Time
+ for _, filterValue := range filterValues {
+ ctr, err := r.LookupContainer(filterValue)
+ if err != nil {
+ return nil, err
+ }
+ containerConfig := ctr.Config()
+ if createTime.IsZero() || createTime.After(containerConfig.CreatedTime) {
+ createTime = containerConfig.CreatedTime
+ }
}
- containerConfig := ctr.Config()
- createTime := containerConfig.CreatedTime
return func(c *libpod.Container) bool {
cc := c.Config()
return createTime.Before(cc.CreatedTime)
@@ -115,17 +146,27 @@ func GenerateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime)
return func(c *libpod.Container) bool {
containerConfig := c.Config()
var dest string
- arr := strings.Split(filterValue, ":")
- source := arr[0]
- if len(arr) == 2 {
- dest = arr[1]
- }
- for _, mount := range containerConfig.Spec.Mounts {
- if dest != "" && (mount.Source == source && mount.Destination == dest) {
- return true
+ for _, filterValue := range filterValues {
+ arr := strings.SplitN(filterValue, ":", 2)
+ source := arr[0]
+ if len(arr) == 2 {
+ dest = arr[1]
}
- if dest == "" && mount.Source == source {
- return true
+ for _, mount := range containerConfig.Spec.Mounts {
+ if dest != "" && (mount.Source == source && mount.Destination == dest) {
+ return true
+ }
+ if dest == "" && mount.Source == source {
+ return true
+ }
+ }
+ for _, vname := range containerConfig.NamedVolumes {
+ if dest != "" && (vname.Name == source && vname.Dest == dest) {
+ return true
+ }
+ if dest == "" && vname.Name == source {
+ return true
+ }
}
}
return false
@@ -136,10 +177,18 @@ func GenerateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime)
if err != nil {
return false
}
- return hcStatus == filterValue
+ for _, filterValue := range filterValues {
+ if hcStatus == filterValue {
+ return true
+ }
+ }
+ return false
}, nil
case "until":
- ts, err := timetype.GetTimestamp(filterValue, time.Now())
+ if len(filterValues) != 1 {
+ return nil, errors.Errorf("specify exactly one timestamp for %s", filter)
+ }
+ ts, err := timetype.GetTimestamp(filterValues[0], time.Now())
if err != nil {
return nil, err
}
diff --git a/libpod/filters/pods.go b/libpod/filters/pods.go
index 3cd97728f..17b3f3ca9 100644
--- a/libpod/filters/pods.go
+++ b/libpod/filters/pods.go
@@ -1,7 +1,6 @@
package lpfilters
import (
- "regexp"
"strconv"
"strings"
@@ -9,13 +8,12 @@ import (
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
)
// GeneratePodFilterFunc takes a filter and filtervalue (key, value)
// and generates a libpod function that can be used to filter
// pods
-func GeneratePodFilterFunc(filter, filterValue string) (
+func GeneratePodFilterFunc(filter string, filterValues []string) (
func(pod *libpod.Pod) bool, error) {
switch filter {
case "ctr-ids":
@@ -24,7 +22,10 @@ func GeneratePodFilterFunc(filter, filterValue string) (
if err != nil {
return false
}
- return util.StringInSlice(filterValue, ctrIds)
+ for _, id := range ctrIds {
+ return util.StringMatchRegexSlice(id, filterValues)
+ }
+ return false
}, nil
case "ctr-names":
return func(p *libpod.Pod) bool {
@@ -33,9 +34,7 @@ func GeneratePodFilterFunc(filter, filterValue string) (
return false
}
for _, ctr := range ctrs {
- if filterValue == ctr.Name() {
- return true
- }
+ return util.StringMatchRegexSlice(ctr.Name(), filterValues)
}
return false
}, nil
@@ -45,18 +44,22 @@ func GeneratePodFilterFunc(filter, filterValue string) (
if err != nil {
return false
}
-
- fVint, err2 := strconv.Atoi(filterValue)
- if err2 != nil {
- return false
+ for _, filterValue := range filterValues {
+ fVint, err2 := strconv.Atoi(filterValue)
+ if err2 != nil {
+ return false
+ }
+ if len(ctrIds) == fVint {
+ return true
+ }
}
- return len(ctrIds) == fVint
+ return false
}, nil
case "ctr-status":
- if !util.StringInSlice(filterValue,
- []string{"created", "restarting", "running", "paused",
- "exited", "unknown"}) {
- return nil, errors.Errorf("%s is not a valid status", filterValue)
+ for _, filterValue := range filterValues {
+ if !util.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
+ return nil, errors.Errorf("%s is not a valid status", filterValue)
+ }
}
return func(p *libpod.Pod) bool {
ctrStatuses, err := p.Status()
@@ -67,55 +70,69 @@ func GeneratePodFilterFunc(filter, filterValue string) (
state := ctrStatus.String()
if ctrStatus == define.ContainerStateConfigured {
state = "created"
+ } else if ctrStatus == define.ContainerStateStopped {
+ state = "exited"
}
- if state == filterValue {
- return true
+ for _, filterValue := range filterValues {
+ if filterValue == "stopped" {
+ filterValue = "exited"
+ }
+ if state == filterValue {
+ return true
+ }
}
}
return false
}, nil
case "id":
return func(p *libpod.Pod) bool {
- return strings.Contains(p.ID(), filterValue)
+ return util.StringMatchRegexSlice(p.ID(), filterValues)
}, nil
case "name":
return func(p *libpod.Pod) bool {
- match, err := regexp.MatchString(filterValue, p.Name())
- if err != nil {
- logrus.Errorf("Failed to compile regex for 'name' filter: %v", err)
- return false
- }
- return match
+ return util.StringMatchRegexSlice(p.Name(), filterValues)
}, nil
case "status":
- if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) {
- return nil, errors.Errorf("%s is not a valid pod status", filterValue)
+ for _, filterValue := range filterValues {
+ if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) {
+ return nil, errors.Errorf("%s is not a valid pod status", filterValue)
+ }
}
return func(p *libpod.Pod) bool {
status, err := p.GetPodStatus()
if err != nil {
return false
}
- if strings.ToLower(status) == filterValue {
- return true
+ for _, filterValue := range filterValues {
+ if strings.ToLower(status) == filterValue {
+ return true
+ }
}
return false
}, nil
case "label":
- var filterArray = strings.SplitN(filterValue, "=", 2)
- var filterKey = filterArray[0]
- if len(filterArray) > 1 {
- filterValue = filterArray[1]
- } else {
- filterValue = ""
- }
return func(p *libpod.Pod) bool {
- for labelKey, labelValue := range p.Labels() {
- if labelKey == filterKey && ("" == filterValue || labelValue == filterValue) {
- return true
+ labels := p.Labels()
+ for _, filterValue := range filterValues {
+ matched := false
+ filterArray := strings.SplitN(filterValue, "=", 2)
+ filterKey := filterArray[0]
+ if len(filterArray) > 1 {
+ filterValue = filterArray[1]
+ } else {
+ filterValue = ""
+ }
+ for labelKey, labelValue := range labels {
+ if labelKey == filterKey && ("" == filterValue || labelValue == filterValue) {
+ matched = true
+ break
+ }
+ }
+ if !matched {
+ return false
}
}
- return false
+ return true
}, nil
}
return nil, errors.Errorf("%s is an invalid filter", filter)
diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go
index 397feac9a..2cfeebcce 100644
--- a/pkg/api/handlers/compat/containers_prune.go
+++ b/pkg/api/handlers/compat/containers_prune.go
@@ -16,7 +16,6 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) {
var (
delContainers []string
space int64
- filterFuncs []libpod.ContainerFilter
)
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
@@ -28,15 +27,14 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
return
}
+ filterFuncs := make([]libpod.ContainerFilter, 0, len(query.Filters))
for k, v := range query.Filters {
- for _, val := range v {
- generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, runtime)
- if err != nil {
- utils.InternalServerError(w, err)
- return
- }
- filterFuncs = append(filterFuncs, generatedFunc)
+ generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
}
+ filterFuncs = append(filterFuncs, generatedFunc)
}
// Libpod response differs
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index 64ddebf9c..c74cdb840 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -289,25 +289,44 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) {
func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- config, err := runtime.GetConfig()
- if err != nil {
- utils.InternalServerError(w, err)
+ ic := abi.ContainerEngine{Libpod: runtime}
+
+ query := struct {
+ Force bool `schema:"force"`
+ }{
+ // This is where you can override the golang default value for one of fields
+ }
+
+ decoder := r.Context().Value("decoder").(*schema.Decoder)
+ if err := decoder.Decode(&query, r.URL.Query()); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
return
}
+
+ options := entities.NetworkRmOptions{
+ Force: query.Force,
+ }
+
name := utils.GetName(r)
- exists, err := network.Exists(config, name)
+ reports, err := ic.NetworkRm(r.Context(), []string{name}, options)
if err != nil {
- utils.InternalServerError(w, err)
+ utils.Error(w, "remove Network failed", http.StatusInternalServerError, err)
return
}
- if !exists {
- utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
+ if len(reports) == 0 {
+ utils.Error(w, "remove Network failed", http.StatusInternalServerError, errors.Errorf("internal error"))
return
}
- if err := network.RemoveNetwork(config, name); err != nil {
- utils.InternalServerError(w, err)
+ report := reports[0]
+ if report.Err != nil {
+ if errors.Cause(report.Err) == define.ErrNoSuchNetwork {
+ utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
+ return
+ }
+ utils.InternalServerError(w, report.Err)
return
}
+
utils.WriteResponse(w, http.StatusNoContent, "")
}
diff --git a/pkg/api/handlers/utils/pods.go b/pkg/api/handlers/utils/pods.go
index 54ebe2d29..7506dbfd1 100644
--- a/pkg/api/handlers/utils/pods.go
+++ b/pkg/api/handlers/utils/pods.go
@@ -11,8 +11,7 @@ import (
func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport, error) {
var (
- pods []*libpod.Pod
- filters []libpod.PodFilter
+ pods []*libpod.Pod
)
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
@@ -30,14 +29,13 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport
UnSupportedParameter("digests")
}
+ filters := make([]libpod.PodFilter, 0, len(query.Filters))
for k, v := range query.Filters {
- for _, filter := range v {
- f, err := lpfilters.GeneratePodFilterFunc(k, filter)
- if err != nil {
- return nil, err
- }
- filters = append(filters, f)
+ f, err := lpfilters.GeneratePodFilterFunc(k, v)
+ if err != nil {
+ return nil, err
}
+ filters = append(filters, f)
}
pods, err := runtime.Pods(filters...)
if err != nil {
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 855f9ece8..4b69ac74e 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -205,15 +205,13 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
}
func (ic *ContainerEngine) ContainerPrune(ctx context.Context, options entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) {
- var filterFuncs []libpod.ContainerFilter
+ filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters))
for k, v := range options.Filters {
- for _, val := range v {
- generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, ic.Libpod)
- if err != nil {
- return nil, err
- }
- filterFuncs = append(filterFuncs, generatedFunc)
+ generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, ic.Libpod)
+ if err != nil {
+ return nil, err
}
+ filterFuncs = append(filterFuncs, generatedFunc)
}
return ic.pruneContainersHelper(filterFuncs)
}
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go
index 25ea151e7..c52584565 100644
--- a/pkg/domain/infra/abi/network.go
+++ b/pkg/domain/infra/abi/network.go
@@ -96,7 +96,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o
if err := ic.Libpod.RemovePod(ctx, pod, true, true); err != nil {
return reports, err
}
- } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil {
+ } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
return reports, err
}
}
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 258640a81..11374e513 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -282,20 +282,17 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, options entities.PodTopOp
func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOptions) ([]*entities.ListPodsReport, error) {
var (
- err error
- filters = []libpod.PodFilter{}
- pds = []*libpod.Pod{}
+ err error
+ pds = []*libpod.Pod{}
)
+ filters := make([]libpod.PodFilter, 0, len(options.Filters))
for k, v := range options.Filters {
- for _, filter := range v {
- f, err := lpfilters.GeneratePodFilterFunc(k, filter)
- if err != nil {
- return nil, err
- }
- filters = append(filters, f)
-
+ f, err := lpfilters.GeneratePodFilterFunc(k, v)
+ if err != nil {
+ return nil, err
}
+ filters = append(filters, f)
}
if options.Latest {
pod, err := ic.Libpod.GetLatestPod()
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go
index 96b2d754f..3dd7eb0c6 100644
--- a/pkg/ps/ps.go
+++ b/pkg/ps/ps.go
@@ -21,19 +21,17 @@ import (
func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOptions) ([]entities.ListContainer, error) {
var (
- filterFuncs []libpod.ContainerFilter
- pss = []entities.ListContainer{}
+ pss = []entities.ListContainer{}
)
+ filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters))
all := options.All || options.Last > 0
if len(options.Filters) > 0 {
for k, v := range options.Filters {
- for _, val := range v {
- generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, runtime)
- if err != nil {
- return nil, err
- }
- filterFuncs = append(filterFuncs, generatedFunc)
+ generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime)
+ if err != nil {
+ return nil, err
}
+ filterFuncs = append(filterFuncs, generatedFunc)
}
}
@@ -43,7 +41,7 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp
all = true
}
if !all {
- runningOnly, err := lpfilters.GenerateContainerFilterFuncs("status", define.ContainerStateRunning.String(), runtime)
+ runningOnly, err := lpfilters.GenerateContainerFilterFuncs("status", []string{define.ContainerStateRunning.String()}, runtime)
if err != nil {
return nil, err
}
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 415fd169b..f6a084c00 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -6,6 +6,7 @@ import (
"os"
"os/user"
"path/filepath"
+ "regexp"
"strconv"
"strings"
"sync"
@@ -84,6 +85,17 @@ func StringInSlice(s string, sl []string) bool {
return false
}
+// StringMatchRegexSlice determines if a given string matches one of the given regexes, returns bool
+func StringMatchRegexSlice(s string, re []string) bool {
+ for _, r := range re {
+ m, err := regexp.MatchString(r, s)
+ if err == nil && m {
+ return true
+ }
+ }
+ return false
+}
+
// ImageConfig is a wrapper around the OCIv1 Image Configuration struct exported
// by containers/image, but containing additional fields that are not supported
// by OCIv1 (but are by Docker v2) - notably OnBuild.
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index f22a4c3af..75310b961 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -27,6 +25,7 @@ var _ = Describe("Podman checkpoint", func() {
)
BeforeEach(func() {
+ SkipIfRemote("checkpoint not supported in remote mode")
SkipIfRootless("checkpoint not supported in rootless mode")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 965e51973..1d5be218b 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -31,6 +29,10 @@ var _ = Describe("Podman run", func() {
podmanTest.Setup()
podmanTest.SeedImages()
os.Setenv("CONTAINERS_CONF", "config/containers.conf")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
})
AfterEach(func() {
@@ -80,12 +82,14 @@ var _ = Describe("Podman run", func() {
})
It("podman Capabilities in containers.conf", func() {
- os.Setenv("CONTAINERS_CONF", "config/containers.conf")
cap := podmanTest.Podman([]string{"run", ALPINE, "grep", "CapEff", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
os.Setenv("CONTAINERS_CONF", "config/containers-ns.conf")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
session := podmanTest.Podman([]string{"run", "busybox", "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -93,7 +97,6 @@ var _ = Describe("Podman run", func() {
})
It("podman Regular capabilities", func() {
- os.Setenv("CONTAINERS_CONF", "config/containers.conf")
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
result := podmanTest.Podman([]string{"top", "test1", "capeff"})
@@ -105,6 +108,9 @@ var _ = Describe("Podman run", func() {
It("podman drop capabilities", func() {
os.Setenv("CONTAINERS_CONF", "config/containers-caps.conf")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
result := podmanTest.Podman([]string{"container", "top", "test1", "capeff"})
@@ -116,6 +122,9 @@ var _ = Describe("Podman run", func() {
verifyNSHandling := func(nspath, option string) {
os.Setenv("CONTAINERS_CONF", "config/containers-ns.conf")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
//containers.conf default ipcns to default to host
session := podmanTest.Podman([]string{"run", ALPINE, "ls", "-l", nspath})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index b2d55ec1a..c1d3be5ab 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -22,6 +20,7 @@ var _ = Describe("Podman cp", func() {
)
BeforeEach(func() {
+ SkipIfRemote("FIXME: Podman-remote cp needs to work")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go
index c54cf433d..c9041eaba 100644
--- a/test/e2e/image_sign_test.go
+++ b/test/e2e/image_sign_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -21,6 +19,7 @@ var _ = Describe("Podman image sign", func() {
)
BeforeEach(func() {
+ SkipIfRemote("podman-remote image sign is not supported")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index 35fe0980a..1be4ef920 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -19,6 +17,7 @@ var _ = Describe("Podman import", func() {
)
BeforeEach(func() {
+ SkipIfRemote("FIXME: These look like it is supposed to work in remote")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go
index 063dcb631..1e4152709 100644
--- a/test/e2e/mount_rootless_test.go
+++ b/test/e2e/mount_rootless_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -18,9 +16,8 @@ var _ = Describe("Podman mount", func() {
)
BeforeEach(func() {
- if os.Geteuid() == 0 {
- Skip("This function is not enabled for rootfull podman")
- }
+ SkipIfNotRootless("This function is not enabled for rootfull podman")
+ SkipIfRemote("Podman mount not supported for remote connections")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index e710ceda1..c9274553b 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -18,6 +16,7 @@ var _ = Describe("Podman mount", func() {
)
BeforeEach(func() {
+ SkipIfRemote("Podman mount not supported for remote connections")
SkipIfRootless("Podman mount requires podman unshare first to work")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 5d63d5985..ea8d10e78 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -194,12 +194,24 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid2)))
+ session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-names=test", "--filter", "ctr-status=running"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(podid1))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podid2)))
+
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", fmt.Sprintf("ctr-ids=%s", cid)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
+ session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-ids=" + cid[:40], "--filter", "ctr-ids=" + cid + "$"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(podid2))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
+
_, ec3, podid3 := podmanTest.CreatePod("")
Expect(ec3).To(Equal(0))
@@ -210,6 +222,13 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
+ session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-number=1", "--filter", "ctr-number=0"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(podid1))
+ Expect(session.OutputToString()).To(ContainSubstring(podid2))
+ Expect(session.OutputToString()).To(ContainSubstring(podid3))
+
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=running"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -224,6 +243,13 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
+ session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=exited", "--filter", "ctr-status=running"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(podid1))
+ Expect(session.OutputToString()).To(ContainSubstring(podid2))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
+
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=created"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index f3a66e58a..fd08d4308 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -545,4 +545,126 @@ var _ = Describe("Podman ps", func() {
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(ContainSubstring("ago"))
})
+
+ It("podman ps filter test", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--label", "foo=1",
+ "--label", "bar=2", "--volume", "volume1:/test", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid1 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"run", "--name", "test2", "--label", "foo=1",
+ ALPINE, "ls", "/fail"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+
+ session = podmanTest.Podman([]string{"create", "--name", "test3", ALPINE, cid1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--name", "test4", "--volume", "volume1:/test1",
+ "--volume", "/:/test2", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+ Expect(session.LineInOutputContains("test3")).To(BeTrue())
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test1", "--filter", "name=test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+
+ // check container id matches with regex
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "id=" + cid1[:40], "--filter", "id=" + cid1 + "$"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--filter", "status=created"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test3")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--filter", "status=created", "--filter", "status=exited"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+ Expect(session.LineInOutputContains("test3")).To(BeTrue())
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--filter", "label=foo=1", "--filter", "status=exited"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=non=1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(1))
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=bar=2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1", "--filter", "exited=0"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.LineInOutputContains("test2")).To(BeTrue())
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=volume1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=/:/test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "before=test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.LineInOutputContains("test1")).To(BeTrue())
+
+ session = podmanTest.Podman([]string{"ps", "--all", "--filter", "since=test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.LineInOutputContains("test3")).To(BeTrue())
+ Expect(session.LineInOutputContains("test4")).To(BeTrue())
+ })
})
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 9074e19b8..922995060 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -39,6 +37,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to containers/storage", func() {
+ SkipIfRemote("Remote push does not support containers-storage transport")
session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -49,6 +48,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to dir", func() {
+ SkipIfRemote("Remote push does not support dir transport")
bbdir := filepath.Join(podmanTest.TempDir, "busybox")
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
fmt.Sprintf("dir:%s", bbdir)})
@@ -57,6 +57,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to local registry", func() {
+ SkipIfRemote("FIXME: This should work")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -87,6 +88,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to local registry with authorization", func() {
+ SkipIfRemote("FIXME: This does not seem to be returning an error")
SkipIfRootless("FIXME: Creating content in certs.d we use directories in homedir")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
@@ -163,6 +165,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to docker-archive", func() {
+ SkipIfRemote("Remote push does not support docker-archive transport")
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
@@ -171,6 +174,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to docker daemon", func() {
+ SkipIfRemote("Remote push does not support docker-daemon transport")
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
if setup.LineInOutputContains("Active: inactive") {
@@ -196,6 +200,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to oci-archive", func() {
+ SkipIfRemote("Remote push does not support oci-archive transport")
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
@@ -204,6 +209,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to docker-archive no reference", func() {
+ SkipIfRemote("Remote push does not support docker-archive transport")
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s", tarfn)})
@@ -212,6 +218,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to oci-archive no reference", func() {
+ SkipIfRemote("Remote push does not support oci-archive transport")
ociarc := filepath.Join(podmanTest.TempDir, "alp-oci")
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("oci-archive:%s", ociarc)})
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 5765d5ef6..35628d44b 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index 2350fe1e5..58b8d04e5 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -46,6 +44,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
})
Specify("signals are forwarded to container using sig-proxy", func() {
+ SkipIfRemote("FIXME: This looks like it is supposed to work in remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("Doesn't work on ppc64le")
}
@@ -111,6 +110,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
})
Specify("signals are not forwarded to container with sig-proxy false", func() {
+ SkipIfRemote("FIXME: This looks like it is supposed to work in remote")
signal := syscall.SIGFPE
if rootless.IsRootless() {
podmanTest.RestoreArtifact(fedoraMinimal)
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index 987023e4c..19e576490 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -1,5 +1,3 @@
-// +build !remote
-
package integration
import (
@@ -21,6 +19,7 @@ var _ = Describe("Podman trust", func() {
)
BeforeEach(func() {
+ SkipIfRemote("podman-remote does not support image trust")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/troubleshooting.md b/troubleshooting.md
index 604ca9b1d..3ff578142 100644
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -457,7 +457,7 @@ Attempts to run podman result in
One workaround is to disable Secure Boot in your BIOS.
-### 20) error creating libpod runtime: there might not be enough IDs available in the namespace
+### 19) error creating libpod runtime: there might not be enough IDs available in the namespace
Unable to pull images
diff --git a/version/version.go b/version/version.go
index e6b1425ef..a62648eea 100644
--- a/version/version.go
+++ b/version/version.go
@@ -13,4 +13,4 @@ var Version = semver.MustParse("2.2.0-dev")
// APIVersion is the version for the remote
// client API. It is used to determine compatibility
// between a remote podman client and its backend
-var APIVersion = semver.MustParse("2.0.0")
+var APIVersion = semver.MustParse("2.1.0")