4236 Commits

Author SHA1 Message Date
1f1618fcb0 Merge pull request #26478 from ygalblum/pull-with-policy
Podman pull - add policy flag
2025-06-24 18:54:26 +00:00
844ed8296d Merge pull request #26485 from gumimin/update-latest
cmd/podman: add --latest option to update #26380
2025-06-24 18:15:40 +00:00
f21dacc4fb cmd/podman: add --latest option to update #26380
Allow users to target the most recently created container with
`podman update --latest` (short `-l`). The same option already exists
on many other commands, so this brings update in line with the rest of
the CLI and saves users from typing or looking up the newest container.

Fixes: #26380

Signed-off-by: Hayato Kihara <kai.21banana@gmail.com>
2025-06-24 22:06:26 +09:00
5ab4328318 Podman pull - add policy flag
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-06-23 11:28:39 -04:00
e4c810a8f1 fix panic on state refresh
In order to use parallel.Enqueue() it is required to call
parallel.SetMaxThreads() first. However in our main call we have been
doing this after we setup the initial runtime so just move this up.
And while at it move up the cpu and memory profile setup as well so we
can capture the earlier parts as well.

This was most likely introduced by commit 46d874aa52 ("Refactor graph
traversal & use for pod stop") which started using parallel.Enqueue() in
removePod() which then can get called from refresh() when a container
has autoremoval configured.

I tried many hard resets in VMs to reproduce but was unable to do so.
I always got "retrieving temporary directory for container xxx: no such
container" erros instead and it failed to autoremove but no panics.
Besides that many times c/storage was corrupted which made the image I
used unusable and it had to be deleted which is concerning in itself.

Fixes #26469

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-19 12:46:23 +02:00
1f9893817b volumes: add new --uid and --gid option
they allow to override the owner of the volume.  Differently from
-o=uid= and -o=gid= they are not passed down to the mount operation.

Closes: https://issues.redhat.com/browse/RHEL-76452

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-06-18 15:33:09 +02:00
60859b07b7 Merge pull request #26201 from lstocchi/wsl
fix wsl install workflow on machine init command
2025-06-13 09:43:50 +00:00
9748554ba0 Merge pull request #26352 from axel7083/fix/net/valid-url
fix: absolute path usage for kube play on Windows
2025-06-12 15:25:25 +00:00
d680c48eaf fix(cmd): improve ValidURL reliability
fixes https://github.com/containers/podman/issues/26350

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
2025-06-12 14:07:16 +02:00
1e53cacb08 Merge pull request #26232 from 2004joshua/buildxInspect
podman buildx inspect
2025-06-12 08:02:31 +00:00
ac71bc6cf2 vendor: update buildah to latest main
Includes one breaking change for the flag as BuildOutputs now accept a
slice.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-05 12:19:59 +02:00
8532ecb710 fix wsl install workflow on machine init command
this patch changes how the detection of wsl works.
The old way of using wsl --status command output to detect some missing features required by WSL is not fully reliable.
WSL checks if the wsl feature is enabled and if the vmcompute service do exist. However, this is not enough to identify if the virtual machine platform feature is enabled. The vmcompute service could exist because it has been installed by other tools or it could exist but being stopped.

The way proposed by this patch is to try execute the import command and,
if it fails, check the error and if it is related to the Host Compute
Service try to install all features required by WSL.

The flow is the same as before, the user is asked to execute the podman
machine init command with elevated privileges. Eventually, after
enabling WSL and VMP features, the user is asked to reboot the machine.

When the machine restarts, the powershell gets invoked again and execute
the command init.

The code also fixes some issues that could cause misbehaviors when
invoking recursively the elevated shell, like an unreleased lock, or a
missing file.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-06-04 14:26:48 +02:00
99cfdc04db feat: Add OCI Artifact support to the Podman REST API
This patch adds a new endpoint to the REST API called "artifacts" with
the following methods:
- Add
- Extract
- Inspect
- List
- Pull
- Push
- Remove

This API will be utilised by the Podman bindings to add OCI Artifact
support to our remote clients.

Jira: https://issues.redhat.com/browse/RUN-2711

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-06-04 15:49:34 +10:00
6a39f37845 Merge pull request #26216 from flouthoc/reuse-excludes
build: reuse `parse.ContainerIgnoreFile` from buildah
2025-06-03 23:59:19 +00:00
eadded9154 build: reuse parse.ContainerIgnoreFile from buildah
podman's logic to parse excludes from `--ignorefile` is not consistent
with buildah, use code directly from imagebuilder.

Closes: https://github.com/containers/podman/issues/25746

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-06-03 12:03:06 -07:00
87450b8f8b podman buildx inspect support
Added support for "podman buildx inspect". The goal was to replicate the default output from "docker buildx inspect" as
much as possible but a problem encountered was podman not supporting BuildKit. To replicate the output I resorted to
printing the statements with default values but only changed the driver name to use podman instead of docker. Since
there was no buildkit, gave it the value of "N/A" to depict it's not supported. For Platforms, I resorted to using
the emulated architectures found on your linux system + the host architecture of your local machine or podman server. The
bootstrap flag was also added but is considered a NOP since there is no buildkit container to run before running inspect.
An extra field was added to the HostInfo struct so when you run "podman info" the emulated architectures will show, this
was used so you can grab the information from the podman engine.

Fixes #13014

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-06-03 11:07:08 -04:00
c87a761e05 podman system check: Fix error check logic
Previously there is a minor logic error, which causes podman system
check to do the check twice although there is no repair flag.

Signed-off-by: Sonny Sasaka <sonnysasaka@gmail.com>
2025-06-02 09:58:42 -07:00
415668c802 system df --verbose don't crash
When a container has no image, i.e. using rootfs like our new infra
containers then the Image function crashed trying to show the first 12
image ID chars. If there is no image simply show nothing there.

Fixes: #26224

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-28 20:50:17 +02:00
265ca77276 Be explicit about ssh configs suitable only for localhost
... and warn loudly against generalization.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-05-15 23:04:49 +02:00
637c264e2e fix issues found by nilness
The conditions are always true so they can be removed. And in the case
of exportCheckpoint() the scope means addToTarFiles was overwritten and
thus when it looped over it later the slice was always empty.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-13 17:20:10 +02:00
499ea1168b Fix: Ensure HealthCheck exec session terminates on timeout
Previously, the HealthCheck exec session would not terminate on timeout, allowing the healthcheck to run indefinitely.

Fixes: https://issues.redhat.com/browse/RHEL-86096

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-05-12 17:01:35 +02:00
b6eeaea7f3 Take path for wsl instead of forcing through WindowsApps
Signed-off-by: Matheus Cunha <matheusvflor@hotmail.com>
2025-05-08 16:39:03 +02:00
5e8e829d7b Merge pull request #25945 from ninja-quokka/podman_machine_swap
feat: Add support for configuring swap in Podman machine
2025-05-02 13:21:48 +00:00
9b2fb40ab8 Quadlet - remove the usage of cid and podid for container and pod files
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-30 07:59:15 -04:00
7b1055a5fb feat: Add support for configuring swap in Podman machine
Add `--swap` argument to `podman machine init` command.

Passing an int64 value to this flag will trigger the Podman machine
ignition file to be generated with a zram-generator.conf file containing
the --swap value as the zram-size argument.

This file is read by the zram-generator systemd service on boot
resulting in a zram swap device being created.

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

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-04-29 12:20:24 +10:00
802fc15b1e Add Label to quadlet pod
Signed-off-by: Robin Heinemeier <sunnerlp@gmail.com>
2025-04-24 13:37:42 +00:00
10d768baaf Add inherit-labels option to Build API
Add the inherit-labels option to the build API and tweak the go.mod
after some unhappiness in my sandbox.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-04-22 23:06:57 -04:00
a3e132055d Merge pull request #25909 from baude/issue25884
Add ability to set layer media type for artifacts
2025-04-22 19:21:14 +00:00
71504eedfb Output headers for volume ls when empty
To have consistency with other podman commands like `ps` and `images`,
`volume ls` should output its headers even when there are no volumes.

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

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-04-21 17:07:57 -05:00
fdfed9979f Add ability to set layer media type for artifacts
in #25884, it was pointed out that the standard detection used to
determine the artifact's file type can be wrong.  in those cases, it
would be handy for the user to be able to override the media type of the
layer.  as such, added a new option called `--file-type`, which is
optional, and allows users to do just that.

`podman artifact add --file-type text/yaml
quay.io/artifact/config:latest ./config.yaml `

Fixes: #25884

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-04-17 10:36:21 -05:00
17f3aed4fd Merge pull request #25899 from ygalblum/quadlet-unit-deps
Quadlet - translate dependencies on other quadlet units
2025-04-16 21:03:52 +00:00
e498c6526b Quadlet - translate dependencies on other quadlet units
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-16 15:29:42 -04:00
5f997a70bd cmd/podman/pods/create: fix break statement
This code was [somewhat messy but] correct until commit 51fbf3da9e
started to use switch instead of if, and since that time break is
breaking from the inner "switch" (rather than on the outer "for" as
originally intended).

This also fixes the following staticcheck warnings:

> cmd/podman/pods/create.go:242:5: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
> 				break
> 				^
> cmd/podman/pods/create.go:245:5: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
> 				break
> 				^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-15 14:55:53 -07:00
48423a615d Merge pull request #25701 from danegsta/danegsta/windowsCpPath
Fix windows path handling in `podman cp`
2025-04-10 16:53:23 +00:00
d5b1eb1cad Merge pull request #25841 from baude/initunits
Correct units in init error message
2025-04-10 12:06:14 +00:00
526aa3aa48 Merge pull request #25839 from timesince/main
chore: make function comment match function name
2025-04-10 10:15:53 +00:00
988e2910d5 Merge pull request #25823 from iphands/main
cmd: Fix help text. --config specifies a dir not a regular file
2025-04-09 17:47:03 +00:00
521b2451c7 Correct units in init error message
When trying to initialize a machine with more memory that the system has
we were outputting an error message in the wrong unit.  It should have
been in MB and B. This was found as part of #25803 but is not the
solution for that issue.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-04-09 09:50:26 -05:00
7cbad232fe chore: make function comment match function name
Signed-off-by: timesince <seekseat@icloud.com>
2025-04-09 19:51:21 +08:00
9a723ff9f5 Fix windows path handling in podman cp
Fixes: #14862

Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-04-08 15:23:08 -07:00
76a4fdc358 cmd: Fix help text. --config specifies a dir not a regular file
This `--config` option was initially added here:
4e4c3e3dbf

Under the hood this simply modifies env to set DOCKER_CONFIG=<passed
in string>

The DOCKER_CONFIG env var is used as a directory that contains
multiple config files... of which podman and container libs probably
only use `$DIR/config.json`.
See: https://docs.docker.com/reference/cli/docker/#environment-variables

The old CMD and help text was misleading... if we point the at a
regular file we can see errors like:
```
$ touch /tmp/foo/tmpcr9zrx71
$ /bin/podman --config /tmp/foo/tmpcr9zrx71 build -t foobar:latest
Error: creating build container: initializing source docker://quay.io/centos/centos:stream9: getting username and password: reading JSON file "/tmp/foo/tmpcr9zrx71/config.json": open /tmp/foo/tmpcr9zrx71/config.json: not a directory
```
^^ In this case we had created `/tmp/foo/tmpcr9zrx71` as a regular file.

Signed-off-by: Ian Page Hands <iphands@gmail.com>
2025-04-08 13:53:34 -07:00
20e1b9db3a Merge pull request #24791 from arsenalzp/issue_24664
Allow filtering containers by command
2025-04-08 12:55:09 +00:00
76eea47fb3 Merge pull request #25743 from kolyshkin/freebsd-golangci-lint
Add freebsd golangci lint run; fix remaining freebsd warnings
2025-04-03 18:30:54 +00:00
b5a1b512c9 Fix overwriting the Healthcheck configuration from the image
If the --health-cmd flag is not specified, other flags such as --health-interval, --health-timeout, --health-retries, and --health-start-period are ignored if the image contains a Healthcheck. This makes it impossible to modify these Healthcheck configuration when a container is created.

Fixes: https://github.com/containers/podman/issues/20212
Fixes: https://issues.redhat.com/browse/RUN-2629

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-04-03 15:52:05 +02:00
8fd7143e36 cmd/podman-testing: fix freebsd compilation
This fixes:

cmd/podman-testing/create.go:1: : # github.com/containers/podman/v5/cmd/podman-testing
cmd/podman-testing/main.go:65:12: undefined: storeBefore
cmd/podman-testing/main.go:69:28: undefined: engineMode
cmd/podman-testing/main.go:99:12: undefined: storeAfter (typecheck)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
c860e67884 cmd/rootlessport: add missing linux build tags
This amends commit 772ead253 ("Use simulated dual-stack binds when using WSL")
which started using linux tag but not for all files.

Alas, this breaks ginkgo run on Windows, so add an exclusion.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:29:21 -07:00
0f975f8526 ci: rm allow-unused from nolintlint settings
This was added by commit 84e42877a ("make lint: re-enable revive"),
making nolintlint became almost useless.

Remove the ungodly amount of unused nolint annotations.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
f4f2580b0d ci: remove stylecheck linter
It is to be merged into staticcheck linter in golangci-lint v2.0.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
0dddc5e3c0 Apply De Morgan's law
This fixes a bunch of "QF1001: could apply De Morgan's law" warnings
from staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
8ef234aedd remove github.com/buger/goterm dependency
this is just a few bytes of escape codes, there is no need to depend on
a library for it. While it is not a big one it still seems better to
just write it ourselves.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 19:17:55 +02:00