6925 Commits

Author SHA1 Message Date
0c4d023822 Fix: inheritlabels=true if query param absent
The inheritlabels param must default to true if query param is absent.

Signed-off-by: Matej Vašek <matejvasek@gmail.com>
2025-04-25 19:17:00 +02:00
ac12341046 Merge pull request #25942 from rcmadhankumar/set-default-mount-option
Remove using `rw` as a default mount option
2025-04-25 13:35:29 +00:00
c28fd3cbd8 Merge pull request #25966 from Luap99/start-rm
remote: don't print bogus error when starting container attached
2025-04-24 18:58:00 +00:00
633f727f2d Quadlet - use helper function for handling key=val type keys
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-24 14:15:39 -04:00
802fc15b1e Add Label to quadlet pod
Signed-off-by: Robin Heinemeier <sunnerlp@gmail.com>
2025-04-24 13:37:42 +00:00
0eac57ed31 podman start: remove container if needed
Like podman run --rm, start --attach must also ensure the contianer is
removed before it exist. Otherwise there is a race where the container
still exist after the command exits, because removal would only happen
by the cleanup process in the background.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-24 15:32:50 +02:00
3a2d7587fe remote: don't print bogus error when starting container attached
This looks like debug leftover, in any case this is not an error so
simply remove the line.

Fixes #25965

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-24 14:31:22 +02:00
bf7dcd5619 Fix: Remove appending rw as the default mount option
The backstory for this is that runc 1.2 (opencontainers/runc#3967)
fixed a long-standing bug in our mount flag handling (a bug that crun
still has). Before runc 1.2, when dealing with locked mount flags that
user namespaced containers cannot clear, trying to explicitly clearing
locked flags (like rw clearing MS_RDONLY) would silently ignore the rw
flag in most cases and would result in a read-only mount. This is
obviously not what the user expects.

What runc 1.2 did is that it made it so that passing clearing flags
like rw would always result in an attempt to clear the flag (which was
not the case before), and would (in all cases) explicitly return an
error if we try to clear locking flags. (This also let us finally fix a
bunch of other long-standing issues with locked mount flags causing
seemingly spurious errors).

The problem is that podman sets rw on all mounts by default (even if
the user doesn't specify anything). This is actually a no-op in
runc 1.1 and crun because of a bug in how clearing flags were handled
(rw is the absence of MS_RDONLY but until runc 1.2 we didn't correctly
track clearing flags like that, meaning that rw would literally be
handled as if it were not set at all by users) but in runc 1.2 leads to
unfortunate breakages and a subtle change in behaviour (before, a ro
mount being bind-mounted into a container would also be ro -- though
due to the above bug even setting rw explicitly would result in ro in
most cases -- but with runc 1.2 the mount will always be rw even if
the user didn't explicitly request it which most users would find
surprising). By the way, this "always set rw" behaviour is a departure
from Docker and it is not necesssary.

Signed-off-by: rcmadhankumar <madhankumar.chellamuthu@suse.com>
2025-04-23 17:18:03 +05:30
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
5372c15bf8 Merge pull request #25892 from Regis-Caelum/quadlet-pod-hostname
Add HostName to quadlet pod
2025-04-22 12:52:04 +00:00
4ba8cde41d Add HostName to quadlet pod
update docs for hostname

Signed-off-by: Inshal Khan <kziaul123@gmail.com>
2025-04-19 08:51:45 +05:30
f9eac5deb0 Merge pull request #25908 from Honny1/fix-ulimits-compat-api-with-rootless
Fix: Compat API in rootless mode ignores ulimits
2025-04-18 20:46:46 +00:00
6ac0a28564 Quadlet - support additional systemd unit relationship keys
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-17 14:51:24 -04: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
3cbb718049 Fix compat API in rootless mode ignores ulimits
Fixes: https://github.com/containers/podman/issues/25881

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-04-17 16:11:34 +02:00
51c4df1316 Merge pull request #25789 from jankaluza/23292
Replace podman pause image with rootfs.
2025-04-17 08:47:30 +00:00
224e791161 Replace podman pause image with rootfs.
This commit removes the code to build a local pause
image from the Containerfile. It is replaced with
code to find the catatonit binary and include it in
the Rootfs.

This removes the need to build a local pause container
image.

The same logic is also applied to createServiceContainer
which is originally also based on the pause image.

Fixes: #23292

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-04-17 08:36:27 +02: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
543a7ea062 pkg/bindings/containers: rm unused break
Reported by staticcheck linter:

> pkg/bindings/containers/term_windows.go:51: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
f691fa7dc4 Merge pull request #25874 from Luap99/lint
update golangci-lint to v2.1.1
2025-04-15 10:30:45 +00:00
09c2546b27 Merge pull request #25844 from ygalblum/quadlet-network-delete
Quadlet - allow deleting the network when stopping the service
2025-04-14 17:57:45 +00:00
f26765ceb0 update golangci-lint to v2.1.1
Fixes three new issues found by nilnesserr.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-14 19:33:42 +02: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
0d4a148ee6 Quadlet - allow deleting the network when stopping the service
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-10 10:34:16 -04:00
c2b5be1e8e Merge pull request #25842 from ygalblum/quadlet-exec-reload
Quadlet - Add support for adding ExecReload command
2025-04-10 14:21:27 +00:00
d5b1eb1cad Merge pull request #25841 from baude/initunits
Correct units in init error message
2025-04-10 12:06:14 +00:00
4aeca9cced Merge pull request #25755 from kolyshkin/unused2
Remove unused code and data structures
2025-04-09 18:58:43 +00:00
fe107ff0ce Quadlet - Add support for adding ExecReload command
Add tests
Update man page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-09 14:40:41 -04: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
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
fd8ed0b2f2 Merge pull request #25796 from Luap99/kube-pod-empty
quadlet kube: consider empty pod as running
2025-04-08 14:07:42 +00:00
c89aa95560 Merge pull request #25828 from IAmJSD/patch-1
Make Go not panic on a partial update
2025-04-08 13:45:06 +00:00
20e1b9db3a Merge pull request #24791 from arsenalzp/issue_24664
Allow filtering containers by command
2025-04-08 12:55:09 +00:00
9cc7c2b4ab Make Go not panic on a partial container update
Right now, if you call Update with only part of the options struct added, it panics. This fixes that by only adding them if they are not nil.

Signed-off-by: Astrid Gealer <astrid@gealer.email>
2025-04-08 13:38:48 +01:00
8d1c373475 quadlet kube: consider empty pod as running
Since commit 945aade38b we do tear down the kube units if all pods
failed to start. This however broke the use case of an empty pod as we
did not consider that being starting successfully which is wrong and
caused a regression for at least one user.

To fix this special case the empty pod and consider that running.

Fixes: #25786
Fixes: 945aade38b ("quadlet kube: correctly mark unit as failed")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-04 19:19:00 +02:00
0a0d05b3e3 Merge pull request #25781 from kolyshkin/rm-goimports
Use golangci-lint fmt for pkg/bindings
2025-04-04 09:38:25 +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
9d4e820264 Use golangci-lint fmt for pkg/bindings
golangci-lint v2 introduced a new command, fmt, which runs configured
formatters (see formatters in .golangci.yml).

Use this for generated files. Drop separate goimports binary.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 10:41:14 -07:00
f18c917ef8 ci: run golangci-lint on freebsd
This could have been done by simply running

	GOOS=freebsd ./bin/golangci-lint run [options] ./...

on Linux, but some freebsd code is using cgo (i.e. is linked to C
libraries), so real freebsd environment is required.

This also fixes the issue of ignoring linter errors for Windows and
Darwin (exit 0), introduced by commit c9b108d5b38.

Fixes: c9b108d5b38 ("Bump golangci-lint to v2.0.2")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 09:24:58 -07: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
5f582e9f11 pkg/emulation: add linux build tag for elf
Otherwise, golangci-lint on freebsd complains:

> pkg/emulation/elf.go:14:6: type elfPlatform is unused (unused)
> type elfPlatform struct {
>      ^
> pkg/emulation/elf.go:28:2: var knownELFPlatformHeaders is unused (unused)
> 	knownELFPlatformHeaders     = make(map[string][][]byte)
> 	^
> pkg/emulation/elf.go:29:2: var knownELFPlatformHeadersOnce is unused (unused)
> 	knownELFPlatformHeadersOnce sync.Once
> 	^
> pkg/emulation/elf.go:33:2: var knownELFPlatforms is unused (unused)
> 	knownELFPlatforms = []elfPlatform{
> 	^
> pkg/emulation/elf.go:157:23: func (*elfPlatform).header is unused (unused)
> func (e *elfPlatform) header() ([][]byte, error) {
>                       ^
> pkg/emulation/elf.go:208:6: func getKnownELFPlatformHeaders is unused (unused)
> func getKnownELFPlatformHeaders() map[string][][]byte {
>      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
6bf1923f3e pkg/specgen: fix ST1019 on freebsd
> pkg/specgen/generate/oci_freebsd.go:15:2: ST1019: package "github.com/opencontainers/runtime-spec/specs-go" is being imported more than once (staticcheck)
> 	"github.com/opencontainers/runtime-spec/specs-go"
> 	^
> pkg/specgen/generate/oci_freebsd.go:16:2: ST1019(related information): other import of "github.com/opencontainers/runtime-spec/specs-go" (staticcheck)
> 	spec "github.com/opencontainers/runtime-spec/specs-go"
> 	^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
118670b31f pkg/specgen/generate: fix S1002 on freebsd
> pkg/specgen/generate/namespaces_freebsd.go:60:9: S1002: should omit comparison to bool constant, can be simplified to !jail.NeedVnetJail() (staticcheck)
> 	return jail.NeedVnetJail() == false
> 	       ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
851bd141af Fix errcheck warnings on freebsd
These two:

> libpod/container_internal_freebsd.go:183:33: Error return value of `c.runtime.state.UpdateContainer` is not checked (errcheck)
> 	c.runtime.state.UpdateContainer(nsCtr)
> 	                               ^
> pkg/specgen/generate/config_freebsd.go:51:12: Error return value is not checked (errcheck)
> 		addDevice(g, resolvedDevicePath)
> 		         ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
f589811073 pkg/rootless: fix ST1005 warning for freebsd
> pkg/rootless/rootless_freebsd.go:24:20: ST1005: error strings should not be capitalized (staticcheck)
> 	return false, -1, errors.New("Rootless mode is not supported on FreeBSD - run podman as root")
> 	                  ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
6c950bdb40 Remove unused code and data structures
No change in functionality.

I might be missing something here, but it appears to be unfinished and
unused.

Fixes: bbd085ad1e ("Podman Pod Create --cpus and --cpuset-cpus flags")
Fixes: 2d86051893 ("Pod Device-Read-BPS support")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-01 16:24:02 -07:00