Commit Graph

201 Commits

Author SHA1 Message Date
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
Matthew Heon bb5e97fdbb We should not be setting a default infra command.
We should be sourcing from the image CMD/ENTRYPOINT by default.
Having a default prevents us from doing that - we should only be
using this for user-configured values that do not come from the
image.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-11-19 15:43:36 -05:00
Daniel J Walsh 766019ca66 Set storage path correctly
Fix handling of storage.conf path, so that we can use it when testing podman.
Currently the Environment variable is not handled correctly.

There is a matching patches in containers/storage and eventually
containers/podman to allow the user of alternative storage.conf files in testing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-24 05:01:41 -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 1ef1790040 Add TERM=xterm to default setting for env
We want to make sure that the TERM envionment variable is always
set.  TERM defaulted to ansi might be better, but we want to match
Docker defaults, so we will stick at xterm.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-18 11:37:15 -04:00
Daniel J Walsh 20e45b9542 Fix CONTAINER_STORAGE_CONF->CONTAINERS_STORAGE_CONF
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-17 15:06:30 -04:00
Daniel J Walsh 964d22fabd Add CONTAINERS_STORAGE_CONF Environment hanlding for testing
Currently it is difficult to modify the path to the storage.conf
file for setting up testing. It is hard coded to use /etc/containers/storage.conf.

Adding this envionment variable, will allow us to write tests on storage.conf
that do not override the system defaults.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-17 14:27:04 -04:00
David Scherer 7b48d849b7 Use homedir.GetConfigHome()
Signed-off-by: David Scherer <david.scherer@antithesis.com>
2020-08-09 10:31:14 -04:00
David Scherer 3ce09ba75f Respect XDG_CONFIG_HOME for policy.json and cni
Use XDG_CONFIG_HOME if it is defined.

XDG_CONFIG_HOME is already respected for configuration files such as containers.conf, storage.conf, and registry.conf but here `~/.config` was hardcoded.

Signed-off-by: David Scherer <david.scherer@antithesis.com>
2020-08-08 13:53:58 -04: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
Ashley Cui 93a6847b2d Add support for Umask
Signed-off-by: Ashley Cui <acui@redhat.com>
2020-07-15 13:59:29 -04:00
Giuseppe Scrivano d6300be2bb rootless: permit custom configuration for cni
I am experimenting with supporting CNI in rootless Podman.  There is
no harm in preparing common to support such case and allow a custom
per-user configuration.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-14 15:43:59 +02:00
Daniel J Walsh 17371297f1 PidsLimit should return 0 if rootless and cgroupfs manager
Only return the Pids Limit for container engines running as root or
with cgroupv2 and Systemd as a cgroup manager.

Trying to do this will rootless containers on cgroup V1 is not allowed.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-02 14:17:09 -04:00
Ashley Cui bf1b8b15b6 Add support for timezone
Signed-off-by: Ashley Cui <acui@redhat.com>
2020-06-30 15:07:49 -04:00
Daniel J Walsh a3a0a08b50 Add support for Remote flags in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-28 15:47:01 -04:00
Daniel J Walsh 7b97b08724 Do not validate paths on remote platforms
Modify validate functions to work on a remote clients.
Any of the path checks will not work on remote machines or make
sense on remote clients. Therefore they should not be checked.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-28 13:29:37 -04:00
Daniel J Walsh 9d3c59e7ad return Containers.PidsLimit iff rootless and cgroupmanager==systemd
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-11 14:01:20 -04:00
Daniel J Walsh c21671b7ca Don't set pids limit on rootless cgroupv1 systems
Pids-limit is not supported on rootless cgroup V1 systems.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-07 13:58:59 -04:00
Daniel J Walsh 92bf3877e9 Specify default paths to policy.json file
Currently if a rootless user runs podman in his homedir, and does
not have /etc/containers/policy.json on the system and does not
have ~/config/policy.json in his homedir, the command fails with
an error.

$ podman pull fedora
Error: error pulling image "fedora": unable to pull fedora: open /etc/containers/policy.json: no such file or directory

If the user has no root rights on the system, he can not create the file.
However the system would work fine if he created the file in his homedir.

With this change, we will force the default to be the file in his homedir if
BOTH files do not exist.  Now the error message for a rootless container would
be.

$ podman pull fedora
Error: unable to pull fedora: open /home/dwalsh/.config/containers/policy.json: no such file or directory

And the user has an idea how to fix this situation.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-05 10:01:09 -04:00
Giuseppe Scrivano 1f92b8cdcb config: default to cgroupns="host" on cgroup v1
cgroupns="private" should be used only on cgroup v2.

On cgroup v1 it would be a breaking change, and also we'd need to
check whether the kernel supports cgroup namespaces.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-23 15:49:37 +02:00
Giuseppe Scrivano dfde2a6744 config: change default for userns to host
by default do not create a user namespace.  A user namespace also
requires mappings to be specified and that is not possible with a
static setting.  We cannot default to "auto" as it requires additional
configuration for the root user.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-22 10:11:02 +02:00
Daniel J Walsh c58a215838 Add support for cgroups configuration
We need to be able to disable cgroups when running container engines inside of containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-13 13:56:16 -04:00
Daniel J Walsh c719975a94 Add RuntimeSupportsKVM to config.Engine
We need to identify the list of containers that support KVM separation, these
containers can run with a different SELinux label, and we might be able to
make different decisions in the container engines about how to launch these
containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-07 10:11:59 -04:00
Daniel J Walsh ed25ff4eb6 Add more utils for returning defaults
Move pkg/sysinfo and pkg/apparmor out of libpod into containers/common.

This will allow other packages to use these libraries without requiring all of libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-01 08:39:44 -04:00
Daniel J Walsh caf7fd95ca Only default to systemd if built with the systemd buildtag
For packages that don't ship with systemd, this changes the default for those distros.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-31 12:57:32 -04:00
Daniel J Walsh a21cf229ee Move pkg/unshare to containers/storage/pkg/unshare
This removes a circular dependancy

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-31 08:42:12 -04:00
Valentin Rothberg ebd70f1b13 use `pause:3.2` image for infra containers
The `pause:3.1` has wrong configs for non-amd64 images as they all claim
to be for amd64.  The issue has now been fixed in the latest
`pause:3.2`.

[1] https://github.com/kubernetes/kubernetes/issues/87325

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-27 13:45:23 +01:00
Daniel J Walsh 4bb3c87228 Add kata containers support
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-27 06:54:25 -04:00
Daniel J Walsh f935da11c9 Move SignaturePolicyPath to Engine instead of Containers
Signatures are an engine struct rather then something
per/container.  Moving to proper location.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-17 16:52:32 -04:00
Daniel J Walsh 50135a792d Change references to libpod to engine
containers/common pkg/config is for more engines then just libpod.

We want to use the 'libpod' section to configure parts of buildah.  Renaming this
section to engine, makes it more obvious to users that these fields can effect other
container engines.

Certain fields are still libpod specific, so we do not change those fields.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-11 14:56:32 -04:00
Daniel J Walsh cf37573798 Drop StorageConfig from containers config structures
Callers should use containers/storage directly.

Also remove MergeDBConfig, this is no longer used by any callers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-11 05:39:35 -04:00
Qi Wang bec93b6703 Add pull_policy to LibpodConfig
pull_policy is the same as podman run --pull option to determin whether to pull a new image when running a container.
Accepted "always", "missing", and "never". Default value is "missing".

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-03 11:13:38 -05:00
Daniel J Walsh 00b0aae703 Add StopTimeout for podman
Allow users to modify the default ammount of time to wait to send SIGKILL
after you tell a container to stop with a SIGINT.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-21 11:32:16 -05:00
Daniel J Walsh 3d6b785749 CgroupManager should belong to libpod not containers
CgroupManager is defined for managing containers, it is not defined
per container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-20 10:27:47 -05:00
Daniel J Walsh 8bd736f5cc Merge pull request #69 from giuseppe/add-setfcap
config: add CAP_SETFCAP to the default capabilities
2020-02-20 09:39:18 -05:00
Giuseppe Scrivano b1841747ed config: add CAP_SETFCAP to the default capabilities
it is needed by Buildah to set file capabilities.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-20 09:49:01 +01:00
Daniel J Walsh ad4b16c9d2 Remove additional_ adjective from containers.conf
Additional is implied, so should not be stated.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-19 09:48:11 -05:00
Carlos Eduardo Arango Gutierrez a93c9e5022 fix typo on var declaration
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-02-18 07:19:27 -05:00
Carlos Eduardo Arango Gutierrez 3e885a69c4 Add annotations into containers.conf file
Closes #62

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-02-17 19:42:11 -05:00
Carlos Eduardo Arango Gutierrez 0d15312d27 Fix lint on default.go
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-02-17 18:18:14 -05:00
Daniel J Walsh a0f632a9d3 Use slirp4netns for default network when in rootless mode
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-12 21:11:56 -05:00
Daniel J Walsh 8241546743 Setup default ulimits to nproc & nofile of current process
In root running containers we want to approach the MAX  Number of processes and
open files, so that services running Podman will work when they have lots of open
files or processes.  In rootless containers this number can not be changed.  This
patch will only increase the numbers if the process is allowed.

Docker set the limit to 2**20 (1048576), it looks like this was the max for RHEL5 OS.
So we fall back to attempt to set this limit if the MAC_PROC limit is not allowed.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-03 13:50:28 -05:00
Daniel J Walsh aa32712804 Fix a couple of defaults
The default alternative path for seccomp.json should be /etc/containers/seccomp.json

The DefaultNetwork in network config should be bridge

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-27 04:05:25 +01:00
Daniel J Walsh b3d6ec550e Fix definitions for cross compilers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-16 16:58:38 -05:00
Giuseppe Scrivano 990e0fc7c3 pkg/cgroups: delete it
at the moment the cgroups package is used only by Podman and by CRI-O
(that is already vendoring libpod).  So let's simplify and not have a
duplicate here.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-09 08:45:00 +01:00
Daniel J Walsh 5760a49664 HooksDir should be in LibpodConfig
This field is owned by libpod and is not part of containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-07 17:53:02 -05:00
Daniel J Walsh 74d7f91c66 Update/Fix man page and fix several bugs in definition.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-03 13:57:01 -05:00
Daniel J Walsh b406a112e1 Add new fields to containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-28 07:22:07 -05:00
Daniel J Walsh 67213c41a3 Remove merge code and optional handling
Fix handling of toml files

No longer need merge, since we can specify a default conf for each toml file.
The toml code will retain the previous defaults and only use the newly specified
values.

This greatly simplifies the code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-11 08:26:52 -05:00
Daniel J Walsh 547b101e3e Change optional bools to be private options
We want to hide Optional Bools from the default configuration.  Callers should only have to deal with boolean
fields and not deal with optionals.

Add accessor functions for all optional bools, easier.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-09 12:01:43 -05:00
Qi Wang 894913abdf add libpod.conf to containers.conf
Add configurations from libpod.conf to containers.conf.Use merge code from libpod to read and merge configurations from file.

Add unshare_linux for build linux: HomeDir should buildah not only for linux. so add unshare_linux for linux and unshare.go for other

convert bool to optinalbool:Use OptionalBool for on-disk configurations so we can distinguish field is undefined  vs. user set to false.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-12-06 15:55:47 -05:00