239 Commits

Author SHA1 Message Date
17783dda68 manifest create,add,inspect
Implememts manifest subcommands create, add, inspect.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-04-22 20:05:21 -04:00
09e821a8ea Merge pull request #5690 from rhatdan/selinux
Add support for selecting kvm and systemd labels
2020-04-16 05:29:19 -07:00
c4ca3c71ff Add support for selecting kvm and systemd labels
In order to better support kata containers and systemd containers
container-selinux has added new types. Podman should execute the
container with an SELinux process label to match the container type.

Traditional Container process : container_t
KVM Container Process: containre_kvm_t
PID 1 Init process: container_init_t

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-15 16:52:16 -04:00
ac94a96a74 Fix up SELinux labeling
SELinux label options processing fixes, should allow system tests to pass.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-15 16:30:03 -04:00
e20ecc733c refactor info
the current implementation of info, while typed, is very loosely done so.  we need stronger types for our apiv2 implmentation and bindings.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-06 12:45:42 -05:00
4352d58549 Add support for containers.conf
vendor in c/common config pkg for containers.conf

Signed-off-by: Qi Wang qiwan@redhat.com
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-27 14:36:03 -04:00
67165b7675 make lint: enable gocritic
`gocritic` is a powerful linter that helps in preventing certain kinds
of errors as well as enforcing a coding style.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-13 14:27:02 +01:00
0b53ff2902 fix lint - drop else block
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:21 +01:00
40f4a00eb3 runtime.go: show registries data and search table
Update podman info command to show the registries data and the search
table.

Signed-off-by: José Guilherme Vanz <jvanz@jvanz.com>
2019-12-13 11:11:28 -03:00
95d26e3f6f runtime.go: show search table in podman info
Updates the podman info command to show registries from v1 config file
in the search table format.

Signed-off-by: José Guilherme Vanz <jvanz@jvanz.com>
2019-12-12 20:54:16 -03:00
4f9672e94c podman: mirror information
Updates the podman info command to show the mirror information

Issue https://github.com/containers/libpod/issues/4553

Signed-off-by: José Guilherme Vanz <jvanz@jvanz.com>
2019-12-12 19:53:46 -03:00
689329f749 Ensure volumes reacquire locks on state refresh
After a restart, pods and containers both run a refresh()
function to prepare to run after a reboot. Until now, volumes
have not had a similar function, because they had no per-boot
setup to perform.

Unfortunately, this was not noticed when in-memory locking was
introduced to volumes. The refresh() routine is, among other
things, responsible for ensuring that locks are reserved after a
reboot, ensuring they cannot be taken by a freshly-created
container, pod, or volume. If this reservation is not done, we
can end up with two objects using the same lock, potentially
needing to lock each other for some operations - classic recipe
for deadlocks.

Add a refresh() function to volumes to perform lock reservation
and ensure it is called as part of overall refresh().

Fixes #4605
Fixes #4621

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-12-02 23:06:00 -05:00
11c282ab02 add libpod/config
Refactor the `RuntimeConfig` along with related code from libpod into
libpod/config.  Note that this is a first step of consolidating code
into more coherent packages to make the code more maintainable and less
prone to regressions on the long runs.

Some libpod definitions were moved to `libpod/define` to resolve
circular dependencies.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-10-31 17:42:37 +01:00
a4a70b4506 bump containers/image to v5.0.0, buildah to v1.11.4
Move to containers/image v5 and containers/buildah to v1.11.4.

Replace an equality check with a type assertion when checking for a
docker.ErrUnauthorizedForCredentials in `podman login`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-10-29 13:35:18 -04:00
59582c55b7 Merge pull request #3792 from haircommander/minimum-conmon
require conmon v2.0.1
2019-10-29 17:44:52 +01:00
306f7cb9f5 require conmon v2.0.1
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-10-28 16:13:58 -04:00
57fa6cf756 require conmon v2.0.0
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-10-28 16:13:58 -04:00
674dc2bc75 Merge pull request #4228 from giuseppe/detect-no-systemd-session
rootless: detect no system session with --cgroup-manager=systemd
2019-10-24 01:20:25 +02:00
13fe146840 rootless: detect no system session with --cgroup-manager=systemd
if the cgroup manager is set to systemd, detect if dbus is available,
otherwise fallback to --cgroup-manager=cgroupfs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-23 09:26:54 +02:00
d2591a5433 Merge pull request #4309 from giuseppe/write-storage-overrides
rootless: write storage overrides to the conf file
2019-10-21 22:02:57 +02:00
fa9982b87e rootless: write storage overrides to the conf file
make sure the user overrides are stored in the configuration file when
first created.

Closes: https://github.com/containers/libpod/issues/2659

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-21 12:07:21 +02:00
64f53b4f02 rootless: do not enable lingering mode
do not automatically enable lingering mode.

Closes: https://github.com/containers/libpod/issues/4224

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-17 19:12:10 +02:00
79d05b99cf Merge pull request #4220 from mheon/null_runtime
Move OCI runtime implementation behind an interface
2019-10-11 20:55:37 +02:00
feba94eb95 Migrate can move containers to a new runtime
This is a horrible hack to work around issues with Fedora 31, but
other distros might need it to, so we'll move it upstream.

I do not recommend this functionality for general use, and the
manpages and other documentation will reflect this. But for some
upgrade cases, it will be the only thing that allows for a
working system.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-10-10 10:25:06 -04:00
6f630bc09b Move OCI runtime implementation behind an interface
For future work, we need multiple implementations of the OCI
runtime, not just a Conmon-wrapped runtime matching the runc CLI.

As part of this, do some refactoring on the interface for exec
(move to a struct, not a massive list of arguments). Also, add
'all' support to Kill and Stop (supported by runc and used a bit
internally for removing containers).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-10-10 10:19:32 -04:00
d3f59bedb3 Update c/image to v4.0.1 and buildah to 1.11.3
This requires updating all import paths throughout, and a matching
buildah update to interoperate.

I can't figure out the reason for go.mod tracking
	github.com/containers/image v3.0.2+incompatible // indirect
((go mod graph) lists it as a direct dependency of libpod, but
(go list -json -m all) lists it as an indirect dependency),
but at least looking at the vendor subdirectory, it doesn't seem
to be actually used in the built binaries.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-04 20:18:23 +02:00
57f4149a87 rootless: set DBUS_SESSION_BUS_ADDRESS if it is not set
if the variable is not set, make sure it has a sane value so that
go-dbus won't try to connect to the wrong user session.

Closes: https://github.com/containers/libpod/issues/4162
Closes: https://github.com/containers/libpod/issues/4164

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-02 09:21:57 +02:00
e4e42e67e3 We need to convert libpod.conf files in user homedir for cgroupv2
If a user upgrades to a machine that defaults to a cgroups V2 machine
and has a libpod.conf file in their homedir that defaults to OCI Runtime runc,
then we want to change it one time to crun.

runc as of this point does not work on cgroupV2 systems.  This patch will
eventually be removed but is needed until runc has support.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-21 10:43:20 +02:00
4f0e095b23 fix trivial type for event logger
Fixes: #4062

Signed-off-by: baude <bbaude@redhat.com>
2019-09-19 18:20:01 -05:00
c2284962c7 Add support for launching containers without CGroups
This is mostly used with Systemd, which really wants to manage
CGroups itself when managing containers via unit file.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-10 10:52:37 -04:00
3a09956dff Ensure good defaults on blank c/storage configuration
If c/storage paths are explicitly set to "" (the empty string) it
will use compiled-in defaults. However, it won't tell us this via
`storage.GetDefaultStoreOptions()` - we just get the empty string
(which can put our defaults, some of which are relative to
c/storage, in a bad spot).

Hardcode a sane default for cases like this. Furthermore, add
some sanity checks to paths, to ensure we don't use relative
paths for core parts of libpod.

Fixes #3952

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-05 17:47:11 -04:00
63d989a344 Add an integration test for systemd in a container
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-28 09:28:49 -04:00
1ff984d509 Merge pull request #2940 from giuseppe/drop-firewall
networking: use firewall plugin
2019-08-21 11:05:16 -07:00
890378e3f7 Merge pull request #3760 from rhatdan/auth
Use GetRuntimeDir to setup auth.json for login
2019-08-19 21:16:06 +02:00
99983e20bb networking: use firewall plugin
drop the pkg/firewall module and start using the firewall CNI plugin.
It requires an updated package for CNI plugins.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-08-19 16:16:06 +02:00
e6673012b5 do not activate sd_notify support when varlink
add ability to not activate sd_notify when running under varlink as it
causes deadlocks and hangs.

Fixes: #3572

Signed-off-by: baude <bbaude@redhat.com>
2019-08-15 12:32:54 -05:00
d27e71374e Use GetRuntimeDir to setup auth.json for login
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-08-12 14:11:53 -04:00
79aeed9681 rootless: cherry-pick runtime from the system configuration
when creating the default libpod.conf file, be sure the default OCI
runtime is cherry picked from the system configuration.

Closes: https://github.com/containers/libpod/issues/3781

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-08-12 14:19:59 +02:00
e2e41a7003 Add conmon probe to runtime construction
Now, when a user's conmon is out of date, podman will tell them

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-08-08 20:24:19 -04:00
37b40e9acd Merge pull request #3466 from TomSweeneyRedHat/dev/tsweeney/myhome
Touch up XDG, add rootless links
2019-08-06 17:42:54 +02:00
577b37b716 honor libpod.conf in /usr/share/containers
we should be looking for the libpod.conf file in /usr/share/containers
and not in /usr/local.  packages of podman should drop the default
libpod.conf in /usr/share.  the override remains /etc/containers/ as
well.

Fixes: #3702

Signed-off-by: baude <bbaude@redhat.com>
2019-08-04 14:04:18 -05:00
7dfaef7766 Add runtime and conmon path discovery
The `$PATH` environment variable will now used as fallback if no valid
runtime or conmon path matches. The debug logs has been updated to state
the used executable.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-08-01 08:32:25 +02:00
52ae51c79f Update libpod.conf to be NixOS friendly
NixOS links the current system state to `/run/current-system`, so we
have to add these paths to the configuration files as well to work out
of the box.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-07-30 12:59:11 +02:00
5779e89809 Touch up XDG, add rootless links
Touch up a number of formating issues for XDG_RUNTIME_DIRS in a number
of man pages.  Make use of the XDG_CONFIG_HOME environment variable
in a rootless environment if available, or set it if not.

Also added a number of links to the Rootless Podman config page and
added the location of the auth.json files to that doc.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-07-29 11:29:41 -04:00
5fb4feb36a Fix a segfault on Podman no-store commands with refresh
When a command (like `ps`) requests no store be created, but also
requires a refresh be performed, we have to ignore its request
and initialize the store anyways to prevent segfaults. This work
was done in #3532, but that missed one thing - initializing a
storage service. Without the storage service, Podman will still
segfault. Fix that oversight here.

Fixes #3625

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-07-23 13:30:30 -04:00
547cb4e55e Merge pull request #3532 from mheon/ensure_store_on_refresh
Ensure we have a valid store when we refresh
2019-07-15 21:26:16 +02:00
e053e0e05e first pass of corrections for golangci-lint
Signed-off-by: baude <bbaude@redhat.com>
2019-07-10 15:52:17 -05:00
5ef972d87b Ensure we have a valid store when we refresh
Fixes #3520

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-07-10 08:55:48 -04:00
1d36501f96 code cleanup
clean up code identified as problematic by golands inspection

Signed-off-by: baude <bbaude@redhat.com>
2019-07-08 09:18:11 -05:00
a22a32a0a5 Merge pull request #3437 from giuseppe/fix-nocgo
build: allow to build without cgo on RISC-V
2019-07-03 15:58:26 +02:00