Commit Graph

7069 Commits

Author SHA1 Message Date
Joe Doss
e9fe245626 Fix shell driver DriverOpts cross-contamination in secret creation
When creating a secret with driver=shell via the API, the file driver's
default DriverOpts (including path) were applied because DriverOpts was
empty. The shell driver rejects path as an unknown option, making it
impossible to create shell-driver secrets via the REST API or
podman-remote.

Only apply default DriverOpts from config when the requested driver
matches the configured default driver.

Signed-off-by: Joe Doss <joe@solidadmin.com>
(cherry picked from commit 667f55c2ce)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
Jan Rodák
15a2a7d605 Remote build: nTar secrets with relative paths and ignore bypass
When `podman-remote` tars the context, extra `podman-build-secret*` paths were
either dropped by `.dockerignore` (#25314) or archived as absolute paths so
`COPY . .` pulled host-shaped trees into the image (#28334).

Use relative names under the primary context for extra sources and do not apply
`.dockerignore` to those forced entries.

Fixes: https://github.com/containers/podman/issues/25314
Fixes: https://github.com/containers/podman/issues/28334

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit e18bb9ea8b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
crawfordxx
e5fe3fdf69 api: fix missing return after error in SystemCheck handler
In the SystemCheck HTTP handler, when parsing the
unreferenced_layer_max_age query parameter fails, the error response is
sent but execution continues to `unreferencedLayerMaximumAge = &duration`
where `duration` is the zero value. This causes the system check to run
with a zero duration instead of returning the 400 error to the client.

Add the missing `return` after the error response.

Fixes #28350

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
(cherry picked from commit 29d80a26af)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
umut-polat
7f37fbd6af quadlet: allow empty Entrypoint to clear image default
Setting Entrypoint= (empty value) in a quadlet .container file should
produce --entrypoint "" in the generated podman command, which clears
the image's default entrypoint. Previously this was silently ignored
because lookupAndAddString skips empty values.

Move the Entrypoint key out of the generic stringKeys map and handle
it separately so that an empty value is passed through.

Closes #28213

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
(cherry picked from commit 926f562bd5)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 13:41:52 +02:00
Jan Rodák
fcc6ae217c [v5.8] Fix unless-stopped containers not restarting after ...
`podman-restart.service` stop them

When `podman-restart.service` stops containers, it marks them as "stopped by
user" which breaks the `unless-stopped` restart policy. Add hidden
`--not-stopped-by-user` flag to prevent this, allowing `unless-stopped`
containers to restart on next boot.

Fixes: https://github.com/containers/podman/issues/28152
Fixes: https://issues.redhat.com/browse/RUN-4357

Cherry pick fixes: https://redhat.atlassian.net/browse/RHEL-157746, https://redhat.atlassian.net/browse/RHEL-157747

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit 7326b862e3)
Signed-off-by: Tom Sweeney <tsweeney@redhat.com>
2026-03-19 19:40:30 -04:00
Ashley Cui
649c074bf5 Merge pull request #28042 from mheon/backports_580_rc1
Backports and release notes for v5.8.0-RC1
2026-02-09 20:10:48 -05:00
Paul Holzinger
6bec23fd04 Merge pull request #27660 from mheon/58_migrate_db
[v5.8] Add migration code for BoltDB to SQLite
2026-02-09 16:06:57 +01:00
ZuhairM7
4e3dd47967 bindings: fix handling of env secrets in remote builds
Previously, using --secret=id=foo,env=BAR in remote mode would fail because the client sent the env var name to the server, which tried to resolve it locally. This patch modifies the client to resolve the environment variable locally, write it to a temp file, and send it as a file-based secret.

Fixes #27494

Signed-off-by: ZuhairM7 <ZuhairM7>
Signed-off-by: ZuhairM7 <zuhairmerali@gmail.com>
2026-02-06 15:36:47 -05:00
Jan Rodák
86b6c75cef Fix unless-stopped restart policy to match Docker behavior
- Update documentation: Differentiate `unless-stopped` from `always` - containers stopped by the user before a reboot will not restart.
- Add `should-start-on-boot` filter: Identify containers that require a restart after a system reboot.
- Update command documentation: Add `restart-policy` and `label!` filters to the documentation for container commands (rm, ps, start, stop, pause, unpause, restart).
- Add `restart-policy` and `shoud-start-on-boot` to completions.
- Update service: Update `podman-restart.service` to use the `needs-restart=true` filter.
- Preserve state: Preserve the `StoppedByUser` state across reboots.
- Update API: Add a `ShouldStartOnBoot()` method to the Container API.
- Update documentation: Add descriptions for the `should-start-on-boot` filter.

Fixes: https://issues.redhat.com/browse/RHEL-129405
Fixes: https://github.com/containers/podman/issues/20418

Signed-off-by: Jan Rodák <hony.com@seznam.cz>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
0xdvc
35c602bfbb fix: improve userns validation when joining pods
- remove old CLI validation that only checked --pod flag
- add validation in namespaces.go to catch all paths (cli, quadlet, api)
- block userns mixing for all pods with infra, not just ipc/net
- update error message to be clearer
- fix test cleanup to use PodmanExitCleanly()
- use dynamic pod names in system tests to avoid conflicts

fixes #26848

Signed-off-by: 0xdvc <neilohene@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
Vyacheslav Bespalov
d6c79580f8 [Fixes: #27571] Fix 'shouldResolveWinPaths' returning 'false' on Windows
Signed-off-by: Vyacheslav Bespalov <vbespalov@ptsecurity.com>
2026-02-06 15:36:47 -05:00
axel7083
243b623629 fix(api/compat): typo in the remove secret handle
Fixes https://github.com/containers/podman/issues/27548

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
2026-02-06 15:36:47 -05:00
Aaron Ang
8423b3bbd0 Clamp rootless rlimits to host on format
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
Aaron Ang
58a15f1500 Add ulimits to podman update API
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
ryanmccann1024
484858710c feat(exec): Add --no-session flag for improved performance
Fixes: #26588

For use cases like HPC, where `podman exec` is called in rapid succession, the standard exec process can become a bottleneck due to container locking and database I/O for session tracking.

This commit introduces a new `--no-session` flag to `podman exec`. When used, this flag invokes a new, lightweight backend implementation that:

- Skips container locking, reducing lock contention
- Bypasses the creation, tracking, and removal of exec sessions in the database
- Executes the command directly and retrieves the exit code without persisting session state
- Maintains consistency with regular exec for container lookup, TTY handling, and environment setup
- Shares implementation with health check execution to avoid code duplication

The implementation addresses all performance bottlenecks while preserving compatibility with existing exec functionality including --latest flag support and proper exit code handling.

Changes include:
- Add --no-session flag to cmd/podman/containers/exec.go
- Implement lightweight execution path in libpod/container_exec.go
- Ensure consistent container validation and environment setup
- Add comprehensive exit code testing including signal handling (exit 137)
- Optimize configuration to skip unnecessary exit command setup

Signed-off-by: Ryan McCann <ryan_mccann@student.uml.edu>
Signed-off-by: ryanmccann1024 <ryan_mccann@student.uml.edu>
2026-02-06 15:36:47 -05:00
flouthoc
790f21d355 quadlet install: multiple quadlets from single file should share app
Quadlets installed from `.quadlet` file now belongs to a single
application, anyone file removed from this application removes all the
other files as well.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2026-02-06 15:36:47 -05:00
flouthoc
ed79cdfd6a quadlet: add support for multiple quadlets in a single file
Enable installing multiple quadlets from one file using '---' delimiters.
Each section requires '# FileName=<name>' comment for custom naming.
Single quadlet files remain unchanged for backward compatibility.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2026-02-06 15:36:47 -05:00
xiaolinny
e8c334f3cb chore: fix the inconsistent method names in the comments
Signed-off-by: xiaolinny <xiaolincode@outlook.com>
2026-02-06 15:36:47 -05:00
Alessandro Verzicco
d45377c6c8 Ignore auth header with empty JSON object
Signed-off-by: Alessandro Verzicco <152161683+alessandro-verzicco@users.noreply.github.com>
2026-02-06 15:36:47 -05:00
Byounguk Lee
f1dcf63a91 Fixes #27421 aritfact push and pull with authfile
Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
2026-02-06 15:36:47 -05:00
shiavm006
87bb060531 Fix remote client rejecting empty --detach-keys string
The remote client (podman --remote) was incorrectly throwing an error
when --detach-keys="" was specified for attach, run, or start commands.
According to documentation and the v1.7.0 release notes, specifying an
empty string should disable detaching, not cause an error.

Fixes: #27414

Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-02-06 15:36:47 -05:00
Dmitry Konishchev
8b8390522b Escape RequiresMountsFor value
Signed-off-by: Dmitry Konishchev <konishchev@gmail.com>
2026-02-06 15:36:47 -05:00
Lewis Denny
f76be2a94d [play_kube] Add validation to container image field
Fixes: #27784

Signed-off-by: Lewis Denny <lewisdenny@me.com>
2026-02-06 15:36:47 -05:00
shiavm006
6c1378be44 extract shared TTY handling code into helper function
Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-02-06 15:36:47 -05:00
MayorFaj
8eacbd8464 fix: correct env/envFrom precedence in kube play
Fixes: #27287

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-06 13:46:37 -05:00
Gregor Dschung
9e965498aa Fix interfering escaping of commas and spaces in no_proxy variable
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-06 13:46:37 -05:00
Gregor Dschung
4ea22f1b29 Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
Otherwise, the proxy values aren't passed to rootless podman.

Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-06 13:46:37 -05:00
Gregor Dschung
0e4dc26c05 Fix test proxyenv/env_test.go for systems that use proxy variables
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-06 13:46:37 -05:00
Mayowa Fajobi
eb118bafb4 Fix healthcheck argument with spaces split in Docker API (#27818)
Fixes: #26519

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-06 13:46:37 -05:00
givensuman
0747179589 Add AppArmor key to quadlet .container files
Fixes: #27095
Signed-off-by: givensuman <givensuman@duck.com>
2026-02-06 13:46:36 -05:00
MayorFaj
dac1e82710 fix(logs): add tests for nanosecond precision in log timestamps
Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-06 13:46:36 -05:00
MayorFaj
d3bda38309 fix(logs): improve timestamp precision in container logs
Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-06 13:46:36 -05:00
Colin Walters
06fe9b21c1 Fix missing newlines in stderr error messages
I happened to run `podman run --config=/path/to/file` and got
an error without a trailing newline, which was a bit jarring.

Fix the instances I noticed.

Assisted-by: OpenCode (Claude Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2026-02-06 13:46:36 -05:00
Matt Heon
b320fbcaff Add migration code for BoltDB to SQLite
This is gated behind a new option in `podman system migrate`,
`--migrate-db`.

The basic logic is simple:
* Podman is already configured to use BoltDB
* Open a new, fresh SQLite database to write into
* Migrate all database contents as they exist in BoltDB, to
  SQLite.
** Do this as simply as possible: grab the object from the old DB
   and write it into the new DB using the standard Add and Save
   functions.
* Set the new database in the Runtime, close the old one.
* Move the old database file so it won't be reused
* Show a warning if the user explicitly configured BoltDB in
  containers.conf

Our ability to test complex migration scenarios is limited, but
this should handle simple migrations easily.

Fixes #27628

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-05 20:09:37 -05:00
Jan Rodák
7ae6813dfc [v5.8] artifact: Skip AddLocal optimization on WSL
The local API path optimization is ineffective on WSL because of NTFS mounting overhead.

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit d889aeb6af)
2026-02-05 19:33:51 +01:00
Jan Rodák
3918d4ca75 [v5.8] Require absolute path for local API
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit 2f7094c0de)
2026-02-05 19:33:51 +01:00
Jan Rodák
6465c07d21 [v5.8] Add local artifact add API endpoint
Fixes: https://issues.redhat.com/browse/RUN-3385
Fixes: https://github.com/containers/podman/issues/26321

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit 91af437471)
2026-02-05 19:33:46 +01:00
Nicola Sella
bae88e1e5e Add GET /quadlets/{name}/exists
Fixes: https://issues.redhat.com/browse/RUN-4068

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-02-05 14:56:03 +01:00
Nicola Sella
d6023e431f Add DELETE /libpod/quadlets
Fixes: https://issues.redhat.com/browse/RUN-3742

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-02-05 14:55:46 +01:00
Nicola Sella
f2fcc7f09c Add POST /libpod/quadlets
Fixes: https://issues.redhat.com/browse/RUN-3743

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-02-05 14:53:34 +01:00
Nicola Sella
01e0db2931 Add GET /quadlets/{name}/file
Fixes: https://issues.redhat.com/browse/RUN-3716

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-02-05 14:52:30 +01:00
Christophe Fergeau
d0558385ec kube play: Fix fd leak when handling symlinks
The `*os.File` returned by `pathrs.OpenatInRoot` needs to
be closed before returning from `openSymlinkPath`

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2025-12-09 18:29:38 +00:00
Mikhail Dmitrichenko
ba6e527289 fix: check err returned by newGenericDecompressor
There is a couple of newGenericDecompressor function usages, where
returned possibly non-nil `err` is not checked before dereferencing
returned decompressor. It may lead to nil ptr dereferencing.

This commit adds check for `err` to prevent dereferencing potentially
nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
2025-12-09 09:50:13 -05:00
Doug Rabson
68022802fc pkg/specgen/generate: Fix adding host devices on FreeBSD
This was not working when emulating Linux container images on FreeBSD.
The code to handle host devices on FreeBSD relies on the container
having a devfs mount. Unfortunately, the Linux emulation code which adds
this was happening after the host device handling. This changes the
logic so that host device management happens after Linux emulation.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2025-12-09 09:47:22 -05:00
Mario Loriedo
a27cc24f80 Replace FindExecutablePeer with FindHelperBinary
The WSL machine start was using the function FindExecutablePeer that
ignores user configuration (helper_binaries_dir). FindHelperBinary
instead is used when starting the machine for the rest of the providers
and honors user configuration.

This commit requires 4877783c37

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-12-08 14:42:36 +01:00
openshift-merge-bot[bot]
140893c2cb Merge pull request #27611 from openshift-cherrypick-robot/cherry-pick-27604-to-v5.7
[v5.7] podman system migrate fixes when pause process and conmon got killed
2025-11-26 19:42:31 +00:00
Paul Holzinger
9538a7d976 rootless_linux.c: use shortcut for system commands
There doesn't seem any reason why the system commands should not join
the userns. In particular the main commands use ParentNSRequired and
UnshareNSRequired when they don't want to be joined to the main userns.
Since the system command don't set these the go code does the join and
re-exec anyway so might as well use the shortcut to speed that up.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-26 10:18:30 +00:00
Paul Holzinger
0647387bfe SetupRootless handle case where conmon pid are not valid
When trying to join the conmon pid to recreate the pause process based
on the namespace it can be that the pid is no longer valid, i.e. when
conmon crashed or was killed.

Currently we have a big issue that can be reproduced using:
$ podman run -d quay.io/libpod/testimage:20241011 sleep 100
$ killall -9 conmon
$ killall catatonit

All commands would fail as we keep trying to rejoin the namespace of the
non existing conmon process.

So to address that fall back to creating a new namespace if we fail to
join the conmon pids.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-26 10:18:30 +00:00
Paul Holzinger
118ec04065 preallocate paths in SetupRootless
Just a minor improvement as we know the size needed for the slice we can
allocate it only once instead of the append having to resize it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-26 10:18:30 +00:00
Paul Holzinger
6a9ce66e5c fix noMoveProcess in SetupRootless
Based on the description in commit 63ef557 this was added so that the
migrate command does not move the pause process into a separate cgroup.

It should however not disable the rejoining of the userns when the pause
process join failed. BEcause of this we end up calling migrate without a
userns and that then can fail if there are actual contianer it tries to
cleanup.

Fixes: 63ef5576ed ("command: migrate doesn't move process to cgroup")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-26 10:18:30 +00:00