4040 Commits

Author SHA1 Message Date
3a41bccf7d Merge pull request #22941 from ashley-cui/machreset
Podman machine resets all providers
2024-07-01 19:24:18 +00:00
786ea01a64 Error when machine memory exceeds system memory
Close loophole that would allow you to assign more memory than the
system has to a podman machine

Fixes: #18206

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-06-28 10:02:11 -05:00
069eace84b Podman machine resets all providers
Podman machine reset now removes and resets machines from all providers availabe on the platform.

On windows, if the user is does not have admin privs, machine will only reset WSL, but will emit a warning that it is unable to remove hyperV machines without elevated privs.

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-06-27 13:14:29 -04:00
a158eae7ff podman run use pod userns even with --pod-id-file
The pod was set after we checked the namespace and the namespace code
only checked the --pod flag but didn't consider --pod-id-file option.
As such fix the check to first set the pod option on the spec then use
that for the namespace. Also make sure we always use an empty default
otherwise it would be impossible in the backend to know if a user
requested a specific userns or not, i.e. even in case of a set
PODMAN_USERNS env a container should still get the userns from the pod
and not use the var in this case. Therefore unset it from the default
cli value.

There are more issues here around --pod-id-file and cli validation that
does not consider the option as conflicting with --userns like --pod
does but I decided to fix the bug at hand and don't try to fix the
entire mess which most likely would take days.

Fixes #22931

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-24 17:18:08 +02:00
673dde9ec5 Merge pull request #23043 from miyamo2/feat/issues#23038
fix(diff): do not suggest `--latest` when runs on remote with no args
2024-06-24 07:24:55 +00:00
5d009715f6 added check for registry.IsRemote(). and correct error message.
Signed-off-by: miyamo2 <miyamo2@outlook.com>
2024-06-23 15:45:41 +00:00
42a01c0f0c Merge pull request #22967 from rhatdan/build
Remove references to --pull=true and --pull=false
2024-06-21 19:27:36 +00:00
4b3890ccac remote: fix incorrect CONTAINER_CONNECTION parsing
When a user specifies a invalid connection in CONTAINER_CONNECTION then
podman should return a proper error saying so. Currently it ignored the
error and in rootFlags() just exited early with defining any flags. This
caused a panic then when trying to use the flags later.

In order to address this first store the connection error in the
PodmanConfig struct and not abort right away during flag setup. This is
important as the user might have specified a flag with a valid remote
connection. As such we check all flags and only when none were given we
return the connection error.

Also while at it I noticed that the default connection reported via
podman --help was wrong as it only used the old containers.conf field
for it and did not consider the podman-connections.json default.

New regression tests have been added to make sure it behaves correctly.

This fixes the problem reported in the PR #22997.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-21 14:01:22 +02:00
00bcd9aa81 Merge pull request #22733 from nalind/system-check
Add `podman system check`
2024-06-13 10:35:56 +00:00
64091777fe Remove references to --pull=true and --pull=false
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-12 18:16:29 +02:00
730a215025 podman: add new hidden flag --pull-option
add a new flag that allows to override the pull options configured in
the storage.conf file.

e.g.: --pull-option="enable_partial_images=false" can be specified to
Podman to disable partial pulls even if enabled.

Leave it as a hidden configuration flag for now since the API itself
is marked as experimental in c/storage.

Currently c/storage doesn't honor the overrides, being fixed with
https://github.com/containers/storage/pull/1966

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-06-12 15:48:36 +02:00
798beb47ec Merge pull request #22694 from jmaibaum/quadlet-build
Quadlet: Add support for .build files
2024-06-11 20:41:28 +00:00
e0a7adec68 Merge pull request #22957 from rhatdan/squash
--squash --layers=false should be allowed
2024-06-11 19:16:12 +00:00
ad8fc6a74b --squash --layers=false should be allowed
This is the same as what --squash-all is doing, and we already support
--squash with --layers=true since this is the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-10 13:24:05 -04:00
fa4f11facc update golangci-lint to v1.59.1
Includes fixes for new lint warnings from unparam and usestdlibvars.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-10 14:57:45 +02:00
2e70d4201f System tests: add podman system check tests
Testing `podman system check` requires that we have a way to
intentionally introduce storage corruptions.  Add a hidden `podman
testing` command that provides the necessary internal logic in
subcommands.  Stub out the tunnel implementation for now.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-04 10:00:37 -04:00
fec58a4571 Add podman system check for checking storage consistency
Add a `podman system check` that performs consistency checks on local
storage, optionally removing damaged items so that they can be
recreated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-04 10:00:37 -04:00
6417fa7b0f Merge pull request #22850 from giuseppe/do-not-move-podman-cgroups-disabled
libpod: do not move podman with --cgroups=disabled
2024-05-30 20:32:57 +00:00
900e29549a libpod: do not move podman with --cgroups=disabled
The expectation with --cgroups=disabled is that the current cgroup is
used by the container.

Currently the --cgroups=disabled is passed directly to the OCI
runtime, but it doesn't stop Podman from creating a new cgroup when it
doesn't own the current one.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-05-30 16:59:30 +02:00
8b15ec9b29 Merge pull request #22643 from qianxi0410/duplicate-isremote
Remove duplicate `IsRemote`  call
2024-05-30 12:47:53 +00:00
9f823ecb25 Quadlet: Add support for .build files
.build files allow to build an image via Quadlet. The keys from a .build
file are translated to arguments of a `podman build` command by Quadlet.

Minimal keys for .build files are `ImageTag=` and a context directory,
see `SetWorkingDirectory=`, or a `File=` pointing to a Containerfile.

After sorting .build files into the Quadlet dependency order, there
remains a possible dependency cycle issue between .volume and .build
files: A .volume can have `Image=some.build`, and a .build can have
`Volume=some.volume:/some/volume`.

We solve this dependency cycle by prefilling resourceNames with all
image names from .build files before converting all the unit files.

This results in an issue for the test suite though: For .volume's
depending on *.image or *.build, we need to copy these additional
dependencies to the test's quadletDir, otherwise the test will fail.
This is necessary, because `handleImageSource()` actually needs to know
the image name defined in the referenced *.{build,image} file. It cannot
fall back on the default names, as it is done for networks or volumes,
for example.

Signed-off-by: Johannes Maibaum <jmaibaum@gmail.com>
2024-05-27 16:59:39 +02:00
b45364254f working name of pod on start and stop
Signed-off-by: jkwiatko <jkwiatkoski@protonmail.com>
2024-05-25 19:40:21 -04:00
23c830704d Add configuration for podmansh
Use the configuration parameters from the newly introduced
PodmanshConfig struct. This allows podmansh to be configured via
configuration files.

Signed-off-by: phoenix <felix.niederwanger@suse.com>
2024-05-23 11:29:37 +02:00
34d2d20d46 Merge pull request #21670 from tnk4on/rosetta-support
applehv: Rosetta support
2024-05-17 20:39:40 +00:00
fe7cc67ef4 Add Rosetta support for Apple Silicon mac
Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
2024-05-17 17:53:28 +09:00
c46884aa93 podman events: check for an error after we finish reading events
The function that's handing us events will return an error after closing
the channel over which it's sending events, and its caller (in its own
goroutine) will then send that error over another channel.

The logic that started the goroutine is likely to notice that the events
channel is closed before noticing that the error channel has a result
for it to read, so any error that would have been communicated would be
lost.

When we finish reading events, check if the reader returned an error
before telling our caller that there was no error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-05-14 13:18:51 -04:00
3b1c735b67 Fix podman-remote support for podman farm build
Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
2024-05-12 03:01:22 +09:00
6c78a72995 Remove duplicate call
Signed-off-by: qianxi0410 <894871277@qq.com>
2024-05-08 23:02:58 +08:00
1d1dba3843 Add missing option 'healthy' to output of podman run --help
Signed-off-by: Florian Wickert <FlorianWickert@gmail.com>
2024-05-05 18:04:17 +02:00
83dbbc3a51 Replace golang.org/x/exp/slices with slices from std
Use "slices" from the standard library, this package was added in go
1.21 so we can use it now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-23 11:16:40 +02:00
c2cadfb5c5 Merge pull request #22322 from mheon/update_the_config
Make `podman update` changes persistent
2024-04-22 07:50:48 +00:00
90304dd507 cmd: use fileutils.(Le|E)xists
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-04-19 09:52:14 +02:00
7b3456b5d9 add list as an alias to list networks
this makes it consistent with other commands,
but also makes the example actually work

Signed-off-by: Evgeni Golov <evgeni@golov.de>
2024-04-17 17:10:22 +02:00
482ef7bfcf Add support for updating restart policy
This is something Docker does, and we did not do until now. Most
difficult/annoying part was the REST API, where I did not really
want to modify the struct being sent, so I made the new restart
policy parameters query parameters instead.

Testing was also a bit annoying, because testing restart policy
always is.

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-04-17 08:23:51 -04:00
be3f075402 Make podman update changes persistent
The logic here is more complex than I would like, largely due to
the behavior of `podman inspect` for running containers. When a
container is running, `podman inspect` will source as much as
possible from the OCI spec used to run that container, to grab
up-to-date information on things like devices. We don't want to
change this, it's definitely the right behavior, but it does make
updating a running container inconvenient: we have to rewrite the
OCI spec as part of the update to make sure that `podman inspect`
will read the correct resource limits.

Also, make update emit events. Docker does it, we should as well.

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-04-17 08:23:50 -04:00
0bedf7f1d2 podman ps: show exposed ports under PORTS as well
Docker shows exposed ports as just PORT/PROTO so match that behavior. It
is not clear to me why someone needs that information in ps as "expose"
doesn't effect anything networking related.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-10 14:24:23 +02:00
59ee130048 chore: fix function names in comment
Signed-off-by: lvyaoting <lvyaoting@outlook.com>
2024-04-08 11:36:50 +08:00
10995192f8 update github.com/rootless-containers/rootlesskit to v2
Contains a breaking change but also besides this renovate is not able to
update the import paths so this needs to be done by hand.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-05 12:25:02 +02:00
f2c365c6f6 rm --force work for more than one arg
When we remove with --force we do not return a error if the input does
not exists, however if we get more than on input we must try to remove
all and not just NOP out and not remove anything just because one arg
did not exists.

Also make the code simpler for commands that do have the --ignore option
and just make --force imply --ignore which reduces the ugly error
handling.

Fixes #21529

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-04 17:47:28 +02:00
11415b3e74 Use built-in ssh impl for all non-pty operations
Windows is not guaranteed to have the SSH feature installed, so prefer the use
of the built-in ssh client for all operations other than podman machine ssh,
which requires terminal pty logic. This restores previous behavior in 4.x.

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-03-24 21:25:22 -05:00
3a9968ef81 fix remote build isolation on client side
Follow up to 493179be45 which only fixed the issue on the server despite
me trying to fix it on the client as well, with this change here we
always correctly unset the default on the remote client as the
root/rootless status will be wrong.

This means it is enough for users to either have a new server or client
with the bug fix which should make the update process easier.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-22 11:49:47 +01:00
493179be45 fix remote build isolation when server runs as root
I am really not sure why the caller even should have the option to set
this. We should always use the correct isolation type based on the
privileges the server runs under never the client. podman-remote build
seems to send the default based on its local privs which was wrong as
well. To fix this I also changed the client to send the default if the
isolation flag is not set.

Fixes #22109

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-21 14:17:55 +01:00
c35fa14616 Merge pull request #22083 from giuseppe/drop-conversion
utils: drop conversion float->string->float
2024-03-20 15:37:42 +00:00
2566ee2f38 utils: drop conversion float->string->float
remove unclear conversion to string to handle float precision.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-03-18 23:06:06 +01:00
e82d196269 pkg/machine: make checkExclusiveActiveVM race free
We need to take another lock to prevent concurrent starts from different
machines.

I manually tested it by starting three VM in parallel with:
podman machine start & podman machine start test1 & podman machine start test2

I also added a CI test that seems to work as expected (failed with the
old binary, worked with the new)

Before this patch I was able to start more than VM, with this patch it
now only starts one of them and the other ones will fail to start with
a proper error.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-14 11:13:08 +01:00
2e52b4fa78 Merge pull request #21982 from Luap99/machine-compose
podman compose: enable machine socket connection
2024-03-07 18:42:24 +00:00
5d3a19f8d0 podman compose: enable machine socket connection
This can be enabled now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 17:34:05 +01:00
25f3a8ce77 podman machine start/stop do not write config unlocked
Move the writes into the shim level to make sure they happen while we
hold the machine lock to prevent any race conditions reading/writing the
file.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 15:11:41 +01:00
7a75914921 podman machine init: do not write config unlocked
First make sure we check that a given VM exist when holding the VM lock
for it. The check in cmd/podman/machine/init.go is a nice quick out but
not enough to ensure that 2 processes to not create the same VM at the
same time. The only way to ensure this is by holding the lock and
checking if the VM config file exists.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 14:58:25 +01:00
3c9c5be7da podman machine set: change options only locked
Make sure we only update the machine config when we are locked.
While it doesn't make a functional differnce for cpu and memory it was a
problem for disk size. The disk size must be larger than the previous
one so we must have accurate data on the previous value.

Thus change the settings only while locked and refresh the config so we
have the current up to date values.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 14:19:06 +01:00