split the DBUS_SESSION_BUS_ADDRESS value so that something like:
unix:path=/run/user/1000/bus,guid=817e9ffcfb383869ad17ea8360e7428a
will ignore ",guid=817e9ffcfb383869ad17ea8360e7428a" when checking
that the path exists.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1984531
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Currently if a user puts a typo into a contianers.conf
or puts the keys in the wrong section, then tools using
container-common ignore them. This patch will print them
as warnings, so that the user has some ide.
I have tested this locally with Podman.
./bin/podman run alpine echo hi
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
hi
With ~/.config/containers/containers.conf
[containers]
events_logger = "file"
[engine]
foo="bar"
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
If a root user writes to a config using Write(), and there is not already an /etc/containers/containers.conf, Write() will create it. This config file also needs to be read by non-root podman.
Signed-off-by: Ashley Cui <acui@redhat.com>
This reverts commit 352073be9e as it's
causing a regression as it overwrites any custom OCI runtime with either
rucc, crun or kata. See the Podman CI failure below:
```
[+0383s] not ok 95 podman build - set runtime
[+0383s] # (from function `die' in file test/system/helpers.bash, line 412,
[+0383s] # from function `run_podman' in file test/system/helpers.bash, line 220,
[+0383s] # in test file test/system/070-build.bats, line 70)
```
I currently do not have the time for a proper fix but the next commit
attempting to address the warnings must include tests.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
On Mac and Windows, automtically read default rootless config location, since
unshare.IsRootless doesn't work.
Signed-off-by: Ashley Cui <acui@redhat.com>
The following changes were not split into smaller commits since the
entire package is still work in progress and I want to keep moving:
* Various small fixes.
* The internal image cache has been removed as it's a recipe for
inconsistencies for longer running processes. This should make
libimage easier to use for CRI-O and a Podman service.
* LookupImage now returns storage.ErrUnknownImage rather than nil.
This simplifies the callers and makes sure we have a consistent
error.
* LookupImage is now able to handle manifests lists. Unless the
platform is explicitly ignored via the options, the matching
image within the manifest list is now returned. This greatly
simplifies the spec generation in Podman; no callers should have
to worry about this kind of detail.
* LookupImage has been refactored into smaller-sized and easier to
read functions.
* RemoveImages has been changed to assemble the data of removed or
untagged images. This comes in handy for pruning images. I am
heavily against having a dedicated API for pruning since the it's
really just a combination of filtering and removing images which
RemoveImages already supports. Hence these changes to satisfy
the needs of `podman image prune`.
Furthermore, it now returns an []error slice rather than a single
error. Again to make Podman happy which needs to inspect *all*
errors for setting the appropriate exit code.
* A rather large refactoring of the removal code along with very
verbose comments. Those were largely absent in the Podman code base
but there many rules and contracts embedded that I partially could
only reconstruct by manually tests and comparing to Docker.
* Add a new `containers={true,false}` filter which allows filtering
images whether they are used by containers (=true) or if no container
is using them (=false). This filter is required for pruning images
in Podman.
* `libimage/types` has been merged into `libimage`. Podman has to do
_a lot of_ massaging for the remote client already and the types
are pretty much nailed down for the remote API. Hence, I prefer to
do some translation between `libimage` types and what Podman needs
rather than splitting `libimage` in half without an obvious reason.
This way the package is self-contained allowing for an easier
navigation and maintenance.
* `libimage.PullPolicy` has been merged into `pkg/config.PullPolicy`
to have _one_ central place to deal with pull policies. The type
system in `pkg/config` sets "always" as the default unfortunately
but I think consistency is more important at that point.
* Added `CopyOptions.DirForceCompress` to enforce layer compression
when copying to a `dir` destination.
* We now use `github.com/disiqueira/gotree` for pretty printing image
trees. That greatly simplifies the code and we don't have to worry
about the logic of printing a tree. Note that trees are now always
printed top down!
* Added a new `libimage.ManifestList` type along with an API for local
lookups and performing certain operations on it to wrap around
`libimage/manifests` as previously done in `libpod/image` and other
places in Podman.
* Correct caching of `(*Image).Inspect`.
* In addition to username, password and credentials, allow for
speciying an identity token for copying images. That's needed for
Podman's remote API.
* Make image removal more tolerant toward corrupted images.
* A new "until=timestamp" filter that can be used by all APIs
supporting filtering.
* An empty string now resolves to PullPolicyMissing.
* `(*Runtime) systemContextCopy()` returns a deep copy of the runtime's
system context. Golang's shallow copies are very dangerous for long
running processes such as Podman's system service. Hence, we need to
make sure that base data is not altered over time. That adds another
external dependency but I do not see a way around that. Long term,
I desire a `(*containers/image/types.SystemContext).Copy()` function.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Move contents of configs to Trace level, so debug information
will just tell you what the confile files are reading rather
then its contents.
[NO TESTS NEEDED]
Helps cleanup: https://github.com/containers/podman/issues/4854
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
golang builtin OS functions, include the path to the object being used,
no reason for us to wrap these errors with an object for a second time.
This just causes stuttering, and looks bad at the CLI level.
Existing tests should catch any errors.
Also stop adding "error" to something that is obviusly an error when it
shows up to the user.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Currently when pulling/pushing images we default to the format
of the source image. When Building images we default to OCI.
Customers have asked us to allow them to force a specific image
type when pushing to a registry.
We already have a flag to building images.
This PR adds image_default_format to define the format to be used
by all tools create/building/pulling and pusing images.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This will allow users to configure the amount of parallel copies that
the container engines are allowed to do. This allows users to configure
their systems to match their available network settings.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Need to be able to getdefault container environment
based on use provided functions on httpProxy and use
the environment from the host.
This way users can modify the environment from podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Users could have any one of the OCI runtimes installed,
code will search for default. This way they do not need
to modify defaults if they have "crun" installed.
Search order will be crun, runc, kata
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
We decided that making users explicitly list plugins they wanted
to use was not a bad thing, and greatly simplifies our
implementation. As such, we need a place to do that, and
`containers.conf` is the logical location.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Also fixup some formatting issues in man pages.
Fix generation of multiple man pages.
Partial fix for: https://github.com/containers/podman/issues/7888
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This flag would allow users to run the podman command
in podman-remote mode by default. If you are primarily using
podman to access a remote server, you might want to enable this
flag and not have to install podman-remote as well as podman command.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Some users want to stick to "docker" format escecially since some older
container registries don't properly support OCI images.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Users on the MAC have pointed out that they could have multiple connections
to different servers, and they asked to be able to specify the connection
name via environmnet variable rather then to always have to specify the
connection on the command line if they did not want to use the default
setting.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Set pullpolicy case-insensitive for fixing https://github.com/containers/podman/issues/7246. And replce the duplicate code in podman with c/common code.
Signed-off-by: Qi Wang <qiwan@redhat.com>
We now use wrapped errors instead of indirectly wrapping them by
`fmt.Errorf`. The error messages have also been cleaned-up to reduce
duplicate words like `failed`.
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
podman remote clients that run on windows and darwin cannot use the isRootless to determine the configuration file locations. here we do by OS and also honor the environment variable.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Add an option to control the default behavior of `podman save` or other
container engines. If set to "true", the engine will create a
multi-image (docker) archive. By default, Podman will interpret
additional arguments as tags that'll be stored in the archive's
manifest. Docker interprets additional arguments as images to allow for
creating multi-image archives. This option allows users to chose how
they wish the default behavior to look like, so we don't break
compatibility with existing Podman workloads while being compatible
with Docker.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>