Commit graph

4909 commits

Author SHA1 Message Date
Lokesh Mandvekar
b125156c32
Add sha256: to images history id for docker compatibility
Add sha256: prefix to image IDs in compat API history responses for
Docker compatibility. Excludes bash test changes as those were already
added by the previous commit.

Fixes: https://github.com/containers/podman/issues/17762

(partial cherry-pick from commit edaf3b4d5e)

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-02-05 16:06:00 +05:30
Daniel J Walsh
fa7b08fd1b
Use default_ulimits field in containers.conf
The default_ulimits field is currently ignored in podman run commands.
This PR fixes this.

Fixes: https://github.com/containers/podman/issues/17396

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
(cherry picked from commit 6046832f3e)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-02-04 19:52:40 +05:30
Paul Holzinger
901151794c
use FindInitBinary() for init binary
Use the new FindInitBinary() function to lookup the init binary, this
allows the use of helper_binaries_dir in contianers.conf[1]

[NO NEW TESTS NEEDED]

[1] https://github.com/containers/common/issues/1110

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit efe5e98d06)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-29 18:41:51 +05:30
Lokesh Mandvekar
36c1973661
tests: fix "Storing signatures" check
After[1] c/image no longer prints "Storing signatures" so we should
not check for it.

[1] https://github.com/containers/image/pull/2001

(partial cherry-pick from commit 6eaf8a271d)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-29 18:41:43 +05:30
Lokesh Mandvekar
7c2eb4006c
Add remote build functionality for podman-remote
This commit adds:
- Remote build implementation (build_remote.go)
- Version command for remote builds (version_remote.go)
- Fix error handling in images_build.go

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-19 16:38:27 +05:30
Lokesh Mandvekar
4231526e18
Add build-tagged splits for libimage-dependent code
The common v0.57.7 vendor bump added !remote build tags to libimage,
causing podman-remote builds to fail. This change splits files that
use libimage into separate _local and _remote variants:

- pkg/specgen/specgen_{local,remote}.go: Image field storage and methods
- pkg/api/handlers/types_local.go: ImageDataToImageInspect function
- cmd/podman/utils/error_local.go: ExitCodeFromBuildError function

This allows type definitions to be shared between remote and local
builds while keeping libimage-dependent implementations local-only.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-12-18 10:27:49 -05:00
tomsweeneyredhat
e035eb4ffa [v4.4-rhel] Adjust for common bump
The vendoring of Buildah dragged in a bump of common from v0.51.4 to
v0.57.7 which contained many changes to variable and function names.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-12-17 15:40:01 -05:00
Chetan Giradkar
6597a24d6c [v4.4.1-rhel] Change priority for cli-flags for remotely operating
... Podman
cli flags couldn't override the active-destination when env variables were set. As a remedy, the precedence of cli flags has been changed.

Note: This commit is from #19997 and it brought in some pretty massive changes
to how the remote connections are created.

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-12-17 15:40:01 -05:00
Paul Holzinger
9b1c32869f [v4.4-rhel] replace deprecated selinux/label calls
These functions were removed in github.com/opencontainers/selinux
v1.12.0.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-12-17 15:40:01 -05:00
Paul Holzinger
b026d9272c [v4.4.1-rhel] kube play: don't follow volume symlinks onto the host
For ConfigMap and Secret kube play volumes podman populates the data
from the yaml. However the volume content is not controlled by us and we
can be tricked following a symlink to a file on the host instead.

Fixes: CVE-2025-9566

Fixes: https://issues.redhat.com/browse/RHEL-113150,
https://issues.redhat.com/browse/RHEL-113143,
https://issues.redhat.com/browse/OCPBUGS-61271, https://issues.redhat.com/browse/OCPBUGS-61267

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-09-09 20:00:21 -04:00
Sohan Kunkerkar
cbe3e18798 [v4.4.1-rhel] *: migrate image registry to registry.k8s.io
This change is a part of the bigger umbrella issue: https://github.com/kubernetes/k8s.io/issues/4780
Currently, we need this change to get in https://github.com/cri-o/cri-o/pull/6742,
which is failing in CI due to inconsistent vendoring.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
2024-07-20 16:44:53 -04:00
openshift-merge-bot[bot]
661113d391
Merge pull request #20906 from lsm5/v4.4.1-rhel-fr
v4.4.1-rhel backports
2024-04-16 18:07:07 +00:00
Paul Holzinger
b1442ba30c [v4.4.1-rhel] inspect: ignore ENOENT during device lookup
When we walk the /dev tree we need to lookup all device paths. Now in
order to get the major and minor version we have to actually stat each
device. This can again fail of course. There is at least a race between
the readdir at stat call so it must ignore ENOENT errors to avoid
the race condition as this is not a user problem. Second, we should
also not return other errors and just log them instead, returning an
error means stopping the walk and returning early which means inspect
fails with an error which would be bad.

Also there seems to be cases were ENOENT will be returned all the time,
e.g. when a device is forcefully removed. In the reported bug this is
triggered with iSCSI devices.

Because the caller does already lookup the device from the created map
it reports a warning there if the device is missing on the host so it
is not a problem to ignore a error during lookup here.

[NO NEW TESTS NEEDED] Requires special device setup to trigger
consistentlyand we cannot do that in CI.

Original Fixed https://issues.redhat.com/browse/RHEL-11158

This fixes: https://issues.redhat.com/browse/RHEL-20488

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-04-05 16:18:05 -04:00
Aditya R
284c44d04f
remote,build: error if containerignore is symlink
Drop support for remote use-cases when `.containerignore` or
`.dockerignore` is a symlink pointing to arbitrary location on host.

Signed-off-by: Aditya R <arajan@redhat.com>
2024-03-13 20:02:10 +05:30
Ed Santiago
2fe6265079
(Temporary) Emergency CI fix: quay search is broken
Someone please revert this once quay search is fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
(cherry picked from commit 047da19b5f)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2024-01-04 18:48:28 +05:30
Daniel J Walsh
e0654150d0 Support podman --remote when Containerfile is not in context directory
Fixes: https://github.com/containers/podman/issues/18239

[NO NEW TESTS NEEDED]

@test "podman build -f test" in test/system/070-build.bats

Will test this.  This was passing when run on a local system since
the remote end was using the clients path to read the Containerfile
The issue is it would not work in a podman machine since the
Containerfile would/should be a different path.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Cherry-pick to v4.4.1-rhel>

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-08-15 09:46:28 -04:00
tomsweeneyredhat
3db7f4caf2 [v4.4.1-rhel] Add file switch for pre-exec hooks
The long term goal was to provide the customer with a way to turn on the
preexec_hooks processing of scripts by having some kind of configuration
that could be read. I had tried putting it into containers.conf to
start, but that turned out to be unyieldly quickly, and time is of
the essence for this fix. That is mostly due to the fact that this
code is preexecution and in C, the containers.conf file is read in
Go much further down the stack.

After first trying this process using an ENVVAR, I have
thought it over and chatted with others, and will now look for a
/etc/containers/podman_preexec_hooks.txt file to exist. If the admin
had put one in there, we will then process the files in the
directories /usr/libexec/podman/pre-exec-hooks
and /etc/containers/pre-exec-hooks.

Thoughts/suggestions gratefully accepted. This will be a 8.8/9.2 ZeroDay
fix and will need to be backported to the v4.4.1-rhel branch.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2023-04-26 10:12:54 -04:00
Valentin Rothberg
3101c8be24 [v4.4.1-rhel] compat: /auth: parse server address correctly
Use `auth.Login` as `podman login` does which parses and normalizes the
input addresses correctly, especially for docker.io.

This Cherry Picks https://github.com/containers/podman/pull/17581 and
brings in necessary changes to run_test.go from i
5f86fae71f

Addreses: https://bugzilla.redhat.com/show_bug.cgi?id=2183601 and
https://bugzilla.redhat.com/show_bug.cgi?id=2183602 for the RHEL 8.8 and
9.2 ZeroDay

The original Fixed: #17571
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2023-03-31 16:10:16 -04:00
tomsweeneyredhat
6b64861922 [v4.4.1-rhel] Use append() to add elements to a slice (restore)
Backports #17755 from @adrianreber to fix an append issue.  Will be
used for a ZeroDay delivery to RHEL 8.8/9.2.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2177611

Original commit message:

The code was not using append() to add items to a slice.

Accessing non allocated elements of the slice failed with:
```
$ podman container restore -l
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/containers/podman/v4/pkg/domain/infra/abi.(*ContainerEngine).ContainerRestore(0xc00051a8b8, {0x1dbced0, 0xc0000440d0}, {0x2a31b30, 0x0, 0x0}, {0x0, 0x0, 0x0, 0x0, ...})
        /share/go/src/github.com/containers/podman/pkg/domain/infra/abi/containers.go:676 +0x39c
github.com/containers/podman/v4/cmd/podman/containers.restore(0x28fb6c0?, {0xc0002c9080, 0x0, 0x1?})
        /share/go/src/github.com/containers/podman/cmd/podman/containers/restore.go:171 +0x4ef
github.com/spf13/cobra.(*Command).execute(0x28fb6c0, {0xc0000400b0, 0x1, 0x1})
        /share/go/src/github.com/containers/podman/vendor/github.com/spf13/cobra/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x291ab00)
        /share/go/src/github.com/containers/podman/vendor/github.com/spf13/cobra/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /share/go/src/github.com/containers/podman/vendor/github.com/spf13/cobra/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /share/go/src/github.com/containers/podman/vendor/github.com/spf13/cobra/command.go:961
main.Execute()
        /share/go/src/github.com/containers/podman/cmd/podman/root.go:107 +0xcc
main.main()
        /share/go/src/github.com/containers/podman/cmd/podman/main.go:41 +0x7c
```

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2023-03-14 19:52:14 -04:00
Valentin Rothberg
9ca3d1c28e kube play: only enforce passthrough in Quadlet
Only enforce the passthrough log driver for Quadlet. Commit 68fbebf
introduced a regression on the `podman-kube@` template as `podman logs`
stopped working and settings from containers.conf were ignored.

Fixes: #17482
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-20 07:53:56 +00:00
OpenShift Merge Robot
1bde07e041
Merge pull request #17429 from openshift-cherrypick-robot/cherry-pick-17027-to-v4.4
[v4.4] Resolve symlink path for qemu directory if possible
2023-02-08 13:03:47 -05:00
OpenShift Merge Robot
db50458c2b
Merge pull request #17390 from openshift-cherrypick-robot/cherry-pick-17364-to-v4.4
[v4.4] Add missing return after utils.Error()
2023-02-08 10:00:06 -05:00
Nathan Henrie
a1cc3733b1 Resolve symlink path for qemu directory if possible
Fixes https://github.com/containers/podman/issues/17026
Fixes https://github.com/NixOS/nixpkgs/issues/169118

[NO NEW TESTS NEEDED]

Related: https://github.com/NixOS/nixpkgs/pull/163015
Signed-off-by: Nathan Henrie <nate@n8henrie.com>
2023-02-08 14:17:19 +00:00
Erik Sjölund
2b7ea64428 Add missing return after errors
Add missing return after utils.Error(),
utils.InternalServerError(), utils.BadRequest().

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-07 14:51:07 -05:00
Giuseppe Scrivano
1d76a166c6 oci: bind mount /sys with --userns=(auto|pod:)
when using --userns=auto or --userns=pod, we should bind mount /sys
from the host instead of creating a new /sys in the container,
otherwise we rely on the fallback provided by crun, which might not be
available in other runtimes.

Also, in the last version of crun the fallback is stricter than it
used to be before and it uses a recursive bind mount through the new
mount API.  That can be missing on old kernel.

Closes: https://github.com/containers/crun/issues/1131

[NO NEW TESTS NEEDED] to trigger the failure, we need a specific
combination of kernel, libc and OCI runtime.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-02-07 14:40:56 -05:00
OpenShift Merge Robot
cd73289361
Merge pull request #17301 from giuseppe/4.4-fix-tty
[4.4] fix regression with runc --privileged rootless containers
2023-02-01 17:53:52 +01:00
Martin Roukala (né Peres)
ef4e7b8c73
Do not mount /dev/tty into rootless containers
[NO NEW TESTS NEEDED]

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2165875
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
(cherry picked from commit d10860a323)
2023-01-31 22:59:29 +01:00
telday
bbaa542589 Fixes port collision issue on use of --publish-all
The function which generates and assigns a random
port number for the --publish-all functionality
was not properly marking some ports as "used".
In very rare occasions this can cause a randomly
"generated" port to be used twice creating an
impossible container configuration.

Signed-off-by: telday <ellis.wright@cyberark.com>
2023-01-31 15:18:25 +00:00
Jason T. Greene
c3566cda41 Fix usage of absolute windows paths with --image-path
Only assume that http(s) scheme URLs (only ones supported by http.Client anyway) are URLs.
Treat everything else as a file path. (Windows paths can look like a URL scheme)

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2023-01-30 14:34:53 -06:00
nabbisen
9eb9607076 fix #17244: use /etc/timezone where timedatectl is missing on Linux
[NO NEW TESTS NEEDED]

Signed-off-by: nabbisen <nabbisen@scqr.net>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-30 14:38:06 +01:00
Fabian Holler
579c5dc809 Match VT device paths to be blocked from mounting exactly
As @mheon pointed out in PR #17055[^1], isVirtualConsoleDevice() does
not only matches VT device paths but also devices named like
/dev/tty0abcd.
This causes that non VT device paths named /dev/tty[0-9]+[A-Za-z]+ are
not mounted into privileged container and systemd containers accidentally.

This is an unlikely issue because the Linux kernel does not use device
paths like that.
To make it failproof and prevent issues in unlikely scenarios, change
isVirtualConsoleDevice() to exactly match ^/dev/tty[0-9]+$ paths.

Because it is not possible to match this path exactly with Glob syntax,
the path is now checked with strings.TrimPrefix() and
strconv.ParseUint().
ParseUint uses a bitsize of 16, this is sufficient because the max
number of TTY devices is 512 in Linux 6.1.5.
(Checked via 'git grep -e '#define' --and -e 'TTY_MINORS').

The commit also adds a unit-test for isVirtualConsoleDevice().

Fixes: f4c81b0aa5 ("Only prevent VTs to be mounted inside...")

[^1]: https://github.com/containers/podman/pull/17055#issuecomment-1378904068

Signed-off-by: Fabian Holler <mail@fholler.de>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-30 07:33:38 +00:00
OpenShift Merge Robot
492e7aa5a7
Merge pull request #17257 from openshift-cherrypick-robot/cherry-pick-17217-to-v4.4
[v4.4] quadlet: Add device support for .volume files
2023-01-29 11:14:09 -05:00
OpenShift Merge Robot
e47005375b
Merge pull request #17256 from openshift-cherrypick-robot/cherry-pick-17228-to-v4.4
[v4.4] fix: running check error when podman is default in wsl
2023-01-29 11:11:19 -05:00
OpenShift Merge Robot
887669bf0f
Merge pull request #17242 from openshift-cherrypick-robot/cherry-pick-17114-to-v4.4
[v4.4] Allow --device-cgroup-rule to be passed in by docker API
2023-01-27 14:57:19 -05:00
Ingo Becker
45b9e17d7c quadlet: Add device support for .volume files
The Device, Type, Copy and Options keys are now supported in
quadlet  .volume files. This allows users to create filesystem
based volumes with quadlets .volume files.

Signed-off-by: Ingo Becker <ingo@orgizm.net>
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-27 19:48:04 +00:00
shblue21
92bae973cc fix: running check error when podman is default in wsl
If podman is the default wsl distribution, the (default) string is appended and result is assigned false.

[NO NEW TESTS NEEDED]

Fixes #17227

Signed-off-by: shblue21 <jihunkimkw@gmail.com>
2023-01-27 19:47:49 +00:00
Miloslav Trmač
097ca60568 Add (podman {image,manifest} push --sign-by-sigstore=param-file.yaml)
(podman push) and (podman manifest push) now support --sign-by-sigstore=param-file,
using the containers-sigstore-signing-params.yaml(5) file format.

That notably adds support for Fulcio and Rekor signing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-01-27 16:46:28 +01:00
Valentin Rothberg
916ea3e5d6 DB: make loading container states optional
Loading container states speed things up when listing all containers but
it comes with a price tag for many other call paths.  Hence, make
loading the state conditional to allow for keeping `podman ps` fast
without other commands regressing in performance.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-27 09:14:12 +00:00
Daniel J Walsh
3a65466baa Allow --device-cgroup-rule to be passed in by docker API
This looks like the correct fix, but I have no idea how to test.

Fixes: https://github.com/containers/podman/issues/17106

[NO NEW TESTS NEEDED]

Will have reporter verify if this fixes the problem.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-26 22:13:59 +00:00
Valentin Rothberg
9d1c153cfc ps: query health check in batch mode
Also do not return (and immediately suppress) an error if no health
check is defined for a given container.

Makes listing 100 containers around 10 percent faster.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-25 11:24:18 +01:00
Valentin Rothberg
6f519c9bde ps: get network data in batch mode
The network functions popped up in the CPU profiles when listing 2042
containers.  Not a very realistic or common use case but a nice way to
get something on the CPU profiles.

Listing 2042 containers now runs 1.54 times faster.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-24 16:42:26 +01:00
Valentin Rothberg
5925fe1a58 ps: do not create copy of container config
The user is only reading the config, so creating a copy turns out to be
extremely expensive.  With this change, listing containers is 1.39 times
faster than before.

[NO NEW TESTS NEEDED] as it is not a functional change.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-23 14:42:45 +01:00
OpenShift Merge Robot
8252dcceb3
Merge pull request #17168 from danishprakash/add-host-pid
kube-play: add support for HostPID
2023-01-20 11:57:14 -05:00
Paul Holzinger
86699954b1
network create: do not allow default as name
`default` is already used as network mode, i.e. podman run --network
default will choose the default mode not a network named `default`.

We already block names from other network modes, default was forgotten.

Fixes #17169

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-20 14:52:07 +01:00
danishprakash
3ae84fe0a3
kube-play: add support for HostPID in podSpec
* test/play_kube: add tests for hostPID

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-01-20 17:32:59 +05:30
Daniel J Walsh
8f78865151
Add support for podman build --group-add
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-19 10:42:10 -05:00
Daniel J Walsh
ef3f098796
Remove ReservedAnnotations from kube generate specification
Reserved annotations are used internally by Podman and would effect
nothing when run with Kubernetes so we should not be generating these
annotations.

Fixes: https://github.com/containers/podman/issues/17105

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-18 08:46:24 -05:00
OpenShift Merge Robot
cf40adb3df
Merge pull request #17118 from giuseppe/rename-auth-scripts-to-preexec-hooks
rootless: rename auth-scripts to preexec-hooks
2023-01-17 09:53:25 -05:00
OpenShift Merge Robot
7093d1fe5c
Merge pull request #17130 from Luap99/remove-dup-code
commit: use libimage code to parse changes
2023-01-17 05:10:22 -05:00
Giuseppe Scrivano
a581d2a041
rootless: rename auth-scripts to preexec-hooks
to not give a false sense of security since these are not a security
mechanism but a hook to run arbitrary code before executing a
command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-01-17 10:58:46 +01:00