podman events --filter network=<name> was unconditionally returning
'NETWORK is an invalid filter' because the NETWORK case was absent
from the generateEventFilter switch statement in filters.go.
All other first-class event types (container, image, pod, volume)
had corresponding filter cases, but the Network type - despite being
fully defined in config.go along with NetworkConnect/NetworkDisconnect
statuses and the Event.Network field - had no handler.
Add the NETWORK case to filter by network name (e.Network), consistent
with Docker's --filter network= behaviour. ID-prefix matching is
intentionally omitted: for network connect/disconnect events e.ID
holds the container ID, not the network ID, so prefix matching would
only work for create/remove events and silently miss join/leave events.
Also add unit tests (filters_test.go), integration tests
(test/e2e/events_test.go, test/system/090-events.bats), shell
completion support for --filter network= (completion.go), and
document the new filter key in the man page.
Fixes: https://github.com/podman-container-tools/podman/issues/29387
Signed-off-by: Aftab Ali <aftab123215@gmail.com>
These errors only happen on windows or freebsd. They happen when a
function always returns a hard error there so it assumes the condition
is always true which is not the case on another platform.
We then also need to use nolintlint so it does not trigger on linux
where the nolint is not needed otherwise.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Since I use go 1.26 the go fix does not have all the rules built in,
there are newer ones in modernize so run the explicitly to fix more code
for go 1.26.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Plus manually deleting the left over inline functions because go fix
doesn't do that even though they are private functions.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
When pushing a manifest list, --platform=OS[/Arch[/Variant]] selects and pushes a single platform-specific manifest instead of the entire list.
Also, update compat POST /images/{name}/push to support the platform param (Compat v1.46)
Signed-off-by: Ashley Cui <acui@redhat.com>
This commit modernizes the codebase by replacing older, reflection-based sort.Slice and sort.SliceIsSorted calls with the modern slices.Sort and slices.SortFunc introduced in Go 1.21.
This provides better performance and type safety by utilizing generics rather than runtime reflection.
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
ParseBuildOpts downloads a URL or stdin context into a temp dir and
stores it in TmpDirToClose, but the caller only removes that when
ParseBuildOpts returns successfully. Every error return after the
download leaks it, including the authfile check reproduced in #22642
and a plain build of a git URL with no Containerfile, which leaves the
whole clone behind.
Use the same succeeded guard TempDirForURL itself uses, one level up so
it covers both tmpdir call sites and the logfile next to them.
Fixes: #22642
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Problem: podman artifact ls has no way to print just artifact
identifiers. Scripts that want to act on artifacts (e.g. remove them)
have to parse table output or use --format {{.Digest}}. Every other
listing command in podman (images, ps, artifact push/pull) already
supports -q/--quiet for this.
Impact: users can now run `podman artifact ls --quiet` to get one
digest per line, no header, suitable for piping into other podman
commands.
Change: adds a --quiet/-q bool flag to the list command. When set (and
--format is not also given), output.Digest is printed for each
artifact instead of the table.
Signed-off-by: umar11b <uzaman2018@gmail.com>
Having a special wsl work around in the code always felt wrong to me.
This does nothing to fix the pasta or rootful port binding behavior.
To actually fix this for all we can set the new podman 6
default_host_ips containers.conf option in the WSL machine-os image by
default:
[network]
default_host_ips = ["0.0.0.0", "::"]
That should make all code paths bind two sockets which WSL needs as it
is unable to recognize a dual stack ipv6 socket for ipv4 as well.
ref https://github.com/podman-container-tools/podman/issues/29377
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
With podman 6 we switch the main libpod port bind logic used as rootful
over to bind dual stack sockets correctly and no longer default the host
ip to 0.0.0.0.
So -p 8080:8080 should create one dual stack socket that binds all
addresses. While -p 0.0.0.0:8080:8080 -p [::]:8080:8080 should create
two sockets binding v4 and v6 respectively.
Because the go std lib always defaults to dual stack the second case
currently fails with EADDRINUSE which is wrong, so fix that to pass the
right protocol.
This is also how pasta works already so this makes everything consistent
now.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
The 'podman artifact ls' command supports a --format flag accepting a go template string. Some commands (eg 'podman image ls') accept a --format=json parameter, and export pure json object to stdout.
This change adds a --format=json output mode to artifact lists too.
Includes simple documentation mention of --format=json option alongside go template description.
Signed-off-by: ellieayla <1447600+me@users.noreply.github.com>
The Windows installer no longer references this binary: the WiX bundle
entry that launched it was removed in 91e4f69 ("Remove the option to
install WSL/HyperV") and the build step in df4aed7 ("Remove providers
checks from the Windows Installer"). Nothing else in the tree references
it, so the code is dead.
Removing it supersedes the earlier path.Base to filepath.Base fix: with
the binary gone there is no log prefix to repair.
Related to: #25165
Signed-off-by: Gledis Lami <lamigledi@gmail.com>
The farm command is helpful when it comes to building
multi-architecture container images, with a build out on various
different CPU architecture machines (e.g. amd64, arm64 etc). This
produces a multi-architecture image usable on many different kinds
of machines. Once those farms are built, we can list them out (ls)
in a human readable format.
Currently, podman farm list prints out every field (name,
connections, default, etc). The --quiet/-q flags cut the noise by
only printing the names of the farms, rather than all the other
farm list metadata.
The benefit of having this feature is for automation and scripts to
pull just the farm names from the list, which is mostly important
for CI pipelines to loop over.
Signed-off-by: umar11b <uzaman2018@gmail.com>
Replaces regexp.MustCompile with regexp.Delayed from go.podman.io/storage/pkg/regexp
for global regular expressions. This avoids compiling regular expressions
during the global init scope, improving startup performance for all commands.
Tests are kept using regexp.MustCompile where applicable.
Fixes: #29510
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
Podman loads containers.conf before Cobra processes global flags, hiding debug and trace diagnostics emitted during configuration parsing.
Parse early CLI options once so logging is configured first, then reuse the result for modules and remote-mode selection.
Fixes: #25362
Signed-off-by: Marcos Paulo Diniz <marcosdinizpaulo@gmail.com>
Replace path package functions (path.Base, path.Join, path.Dir) with
filepath equivalents in cmd/quadlet/main.go.
Using filepath ensures consistency across operating systems when manipulating
host filesystem paths.
Related to: #25165
Signed-off-by: SHIVAANSH0610_LUFFY <shivaansh0610@gmail.com>
ignore warn and strict modes for unknown yaml fields and kinds
ignore is the default and skips them warn reports them strict fails
warnings are returned in the play report so they show up in the cli and over the api for tools like podman desktop
Closes#18332
Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
Clarify that the compose_providers and compose_warning_logs settings belong in the [engine] table of containers.conf.
Fixes: #29122
Signed-off-by: MayorFaj <mayorfaj@gmail.com>
With the remote client on linux we should not check for cgroups and hard
fail if it is not v2. Only the server side matters not the client.
The problem can be reproduced with:
unshare -rm sh -c "mount -t tmpfs none /sys/fs/cgroup && ./bin/podman --remote ps"
I did not add a regression test as it does not seem to fit well into a
test suite, over mounting cgroups seems like not a good idea.
Fixes: #29241
Signed-off-by: Paul Holzinger <pholzing@redhat.com>