Commit Graph

111 Commits

Author SHA1 Message Date
unknowndevQwQ 1826e711c7 fix: fix #692 2021-08-02 21:43:06 +08:00
Giuseppe Scrivano d7e8c2338b config: split arguments in DBUS_SESSION_BUS_ADDRESS
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>
2021-07-26 15:08:33 +02:00
OpenShift Merge Robot 33633ba029 Merge pull request #678 from vikas-goel/prepare-volume
User option to prepare container after creation for volume copy-up.
2021-07-15 09:22:09 -04:00
Vikas Goel a7668c208f User option to prepare container after creation for volume copy-up.
Docker does this by default.

Relates to podman#10262

[NO TESTS NEEDED]

Signed-off-by: Vikas Goel <vikas.goel@gmail.com>
2021-07-14 12:12:15 -07:00
Matej Vasek 61d2ae986d add config option for ChownCopiedFiles
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-07-13 18:17:12 +02:00
Daniel J Walsh 001e09ea34 Report bad entries in containers.conf to the user
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>
2021-06-30 15:17:05 -04:00
Ashley Cui 9fa534c40a Allow /etc/containers/containers.conf to be read by non-root
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>
2021-06-22 09:52:09 -04:00
OpenShift Merge Robot 10fc9ceca2 Merge pull request #615 from rhatdan/config
Add support for config drop in directories
2021-06-10 16:44:15 -04:00
Daniel J Walsh 4c51429098 Add support for config drop in directories
Fixes: https://github.com/containers/common/issues/368

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-10 16:34:26 -04:00
Tino Rusch 5ec160696b add 'secret' section to the containers.conf struct. 2021-06-10 14:04:32 +02:00
Daniel J Walsh 9c89b403e7 Add default for log-tag
Needed for https://github.com/containers/podman/issues/10204

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-09 08:43:07 -04:00
Brent Baude cf1c43959f rootless networking
Set type of rootless networking with:

rootless_networking = "slirp4netns | cni"

slirp is the default

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-05-20 15:34:44 -05:00
Valentin Rothberg 460874be71 Revert "Do not emit warnings about OCI runtime paths"
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>
2021-05-19 13:12:13 +02:00
OpenShift Merge Robot 6b0f9a2be1 Merge pull request #538 from basilgello/fix-9389
Do not emit warnings about OCI runtime paths
2021-05-12 15:05:47 -04:00
OpenShift Merge Robot 73305281fd Merge pull request #541 from ashley-cui/mac
[NO TESTS NEEDED] Fix reading configs on mac and windows
2021-05-11 17:19:52 -04:00
Ashley Cui e237d2da9b Fix reading configs on mac and windows
On Mac and Windows, automtically read default rootless config location, since
unshare.IsRootless doesn't work.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-05-10 15:27:01 -04:00
Vasyl Gello 352073be9e Do not emit warnings about OCI runtime paths
... before all user configuration files are merged.

This fixes #9389.

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
2021-05-10 21:39:17 +03:00
OpenShift Merge Robot 4769b30832 Merge pull request #527 from rhatdan/cleanup
Add support for codespell, and fix issues found
2021-05-05 17:09:54 -04:00
Daniel J Walsh dee190ce4c Add support for codespell, and fix issues found
[NO TESTS NEEDED] This is just code cleanup

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-05 17:02:11 -04:00
Matthew Heon 85df6670fb Add ability to specify a subnet for the default network
This lays the foundation for c/common to be able to create the
default CNI configuration file itself.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-05-04 11:40:22 -04:00
Valentin Rothberg bc6c57edb5 libimage: follow-up changes
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>
2021-05-03 15:20:40 +02:00
Ashley Cui 24f4991dc1 Add support for machine_enabled in containers.conf
machine_enabled is a bool that indicates if Podman is running in a
podman-machine VM

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-04-23 14:37:18 -04:00
OpenShift Merge Robot 823ce65953 Merge pull request #499 from giuseppe/print-lingering-suggestion-only-for-uid-not-zero
config: suggest enable-linger only if euid != 0
2021-04-19 07:52:52 -04:00
Erik Sjölund bf811e2519 Change log message in findRuntime()
Rephrase the log message and change the log level from
"warning" to "debug".

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

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2021-04-19 13:35:45 +02:00
Giuseppe Scrivano 73003690e2 config: suggest enable-linger only if euid != 0
avoid an unuseful warning message when running Podman as root without
enough capabilities.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-19 13:29:07 +02:00
Daniel J Walsh 3aa87a9ce1 Cleanup debugf information to make debugging more useful
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>
2021-04-13 09:49:42 -04:00
Daniel J Walsh 417d17cba5 [NO TESTS NEEDED] Remove some stuttering on return errors
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>
2021-03-29 10:33:18 -04:00
Daniel J Walsh 0f802d0065 Add image_default_format
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>
2021-02-01 06:38:50 -05:00
Daniel J Walsh 952d2c9991 Add image_parallel_copies engine config
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>
2021-01-21 14:59:34 -05:00
Giuseppe Scrivano 52dd8b2d67 config: fix runtime_supports_nocgroup key name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-13 15:11:54 +01:00
Daniel J Walsh 2694f2c7dc Add new function to setup default environment
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>
2021-01-07 15:48:11 -05:00
Daniel J Walsh 44e14b12b9 Find ociruntime instead of hard coding default
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>
2020-12-15 05:43:45 -05:00
OpenShift Merge Robot 16098c3cca Merge pull request #371 from mheon/add_volume_plugins
Add a volume plugins field to containers.conf
2020-12-04 16:29:28 -05:00
Matthew Heon 33a960773b Add a volume plugins field to containers.conf
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>
2020-12-04 13:48:24 -05:00
Daniel J Walsh f58e310727 Remove libpod.conf
We no longer support libpod.conf, remove any code that deals with it.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-04 08:11:31 -05:00
Daniel J Walsh d568d40354 Add ability to set system wide options for slirp4netns
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>
2020-11-25 13:42:53 -05:00
Daniel J Walsh 69ee79b12c Add support for enabling/disabling kernel keyring in engines
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-20 13:39:24 -05:00
Daniel J Walsh 86a01f6857 Enabled the remote flag to be accessible by users
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>
2020-10-30 05:11:43 -04:00
Daniel J Walsh d2c4ee7ce3 Allow users to specify the default format for image builds
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>
2020-09-21 16:13:48 -04:00
Daniel J Walsh 00631f7fa2 Add support for CONTAINER_CONNECTION environment variable
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>
2020-09-16 07:06:04 -04:00
Daniel J Walsh fd6f9bf750 Fix problems found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-12 05:50:05 -04:00
Qi Wang f1c4d645f6 ValidatePullPolicy case-insensitive
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>
2020-09-10 17:05:35 -04:00
Sascha Grunert 89b399d4cf Fix all gocritic lints
This enables the missing gocritic checks and fixes all of the lints.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-08-25 20:58:15 +02:00
Sascha Grunert b494081304 Change fmt.Errorf calls to be replaced by errors package
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>
2020-08-25 11:37:12 +02:00
Brent Baude 054d133710 getCustomConfigFile for windows and darwin
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>
2020-08-22 09:11:12 -04:00
Valentin Rothberg f217b00ded multi_image_archive: add option for `podman save`
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>
2020-08-17 14:44:43 +02:00
Valentin Rothberg 988b089a30 Merge pull request #221 from giuseppe/permit-rootless-cni
rootless: permit custom configuration for cni
2020-07-21 11:46:04 +02:00
Daniel J Walsh b6bb9b862f Remove extra lock in Reload function
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-19 07:13:12 -04:00
Tom Sweeney b0dff4761d Merge pull request #223 from ashley-cui/umask
Add support for Umask
2020-07-15 19:43:44 -04:00
Daniel J Walsh 3e3982860a Merge pull request #224 from QiWang19/default-cfg
Fix config reload race
2020-07-15 18:07:46 -04:00