Commit graph

42 commits

Author SHA1 Message Date
Matthew Heon 8e5b294ac3 Allow (but ignore) Cached and Delegated volume options
These are only used on OS X Docker, and ignored elsewhere - but
since they are ignored, they're guaranteed to be safe everywhere,
and people are using them.

Fixes: #3340

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-18 17:02:20 -04:00
Jordan Webb d2d57517d7
Fix ENV parsing on podman import
Signed-off-by: Jordan Webb <jordemort@github.com>
2019-06-14 09:43:36 -05:00
Giuseppe Scrivano 23efe4cb81
storage: support --mount type=bind,bind-nonrecursive
add support for not recursive bind mounts.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-13 15:32:45 +02:00
Giuseppe Scrivano f09370c68b
userns: add new option --userns=keep-id
it creates a namespace where the current UID:GID on the host is mapped
to the same UID:GID in the container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-24 17:34:12 +02:00
Giuseppe Scrivano 791d53a214
rootless: use a pause process
use a pause process to keep the user and mount namespace alive.

The pause process is created immediately on reload, and all successive
Podman processes will refer to it for joining the user&mount
namespace.

This solves all the race conditions we had on joining the correct
namespaces using the conmon processes.

As a fallback if the join fails for any reason (e.g. the pause process
was killed), then we try to join the running containers as we were
doing before.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-17 20:48:24 +02:00
Giuseppe Scrivano 8e88461511
rootless, spec: allow resources with cgroup v2
We were always raising an error when the rootless user attempted to
setup resources, but this is not the case anymore with cgroup v2.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-13 10:48:16 +02:00
OpenShift Merge Robot a7809fabe5
Merge pull request #2905 from QiWang19/globalvar
Add variable for global flags to runlabel
2019-05-03 11:30:51 +02:00
OpenShift Merge Robot f3c494eb28
Merge pull request #2959 from mheon/merge_volume_flags
Merge volume flags implementation
2019-05-03 01:30:13 +02:00
Qi Wang a477a8ff75 Add variable for global flags to runlabel
use $GLOBAL_OPTS to pass global flags to the runlabel command.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-05-02 12:14:51 -04:00
Matthew Heon 30257cf073 Ensure that named volumes have their options parsed
This involves moving some code out of pkg/spec/ into util/ so it
can also be used by libpod.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -04:00
baude 0b6bb6a3d3 enable podman-remote on windows
build a podman-remote binary for windows that allows users to use the
remote client on windows and interact with podman on linux system.

Signed-off-by: baude <bbaude@redhat.com>
2019-04-30 15:28:39 -05:00
Giuseppe Scrivano ca38ca49b8
utils: call GetRootlessRuntimeDir once
use a sync.Once to potentially avoid multiple system calls everytime
the function is called.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-29 12:01:13 +01:00
Valentin Rothberg a5443a532b vendor buildah, image, storage, cni
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-03-28 15:12:26 +01:00
Giuseppe Scrivano 232b46a374
utils: split generation and writing of storage.conf
split the generation for the default storage.conf and when we write it
if not existing for a rootless user.

This is necessary because during the startup we might be overriding
the default configuration through --storage-driver and --storage-opt,
that would not be written down to the storage.conf file we generated.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-17 10:45:51 +01:00
Giuseppe Scrivano ea0b36bcbb
utils: avoid too long tmp directory
or we will easily pass the 108 chars limits for unix paths.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-16 15:17:33 +01:00
Giuseppe Scrivano 592a2fd544
rootless: use /tmp/libpod-rundir-$EUID for fallback
when the fallback is in place, the first user creating /tmp/user/$EUID
prevents other users for creating other directories since /tmp/user is
created with mode 0700.

Since there is no way for an unprivileged user to initialize the
/tmp/user directory correctly (we would need it to be owned by root
with the sticky bit set), let's just use /tmp/libpod-rundir-$EUID.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-15 10:39:23 +01:00
baude ca1e76ff63 Add event logging to libpod, even display to podman
In lipod, we now log major events that occurr.  These events
can be displayed using the `podman events` command. Each
event contains:

* Type (container, image, volume, pod...)
* Status (create, rm, stop, kill, ....)
* Timestamp in RFC3339Nano format
* Name (if applicable)
* Image (if applicable)

The format of the event and the varlink endpoint are to not
be considered stable until cockpit has done its enablement.

Signed-off-by: baude <bbaude@redhat.com>
2019-03-11 15:08:59 -05:00
Matthew Heon f68a243f8e Centralize setting default volume path
No reason to do it in util/ anymore. It's always going to be a
subdirectory of c/storage graph root by default, so we can just
set it after the return.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:44:46 -05:00
Matthew Heon 5511cdc487 Ensure volume path is set appropriately by default
There are some cases where we might not be properly adjusting the
volume path after setting the storage graph root. Ensure that we
always set volume path to be a child of graph root.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:39:13 -05:00
Daniel J Walsh 52df1fa7e0
Fix volume handling in podman
iFix builtin volumes to work with podman volume

Currently builtin volumes are not recored in podman volumes when
they are created automatically. This patch fixes this.

Remove container volumes when requested

Currently the --volume option on podman remove does nothing.
This will implement the changes needed to remove the volumes
if the user requests it.

When removing a volume make sure that no container uses the volume.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-14 13:21:52 -05:00
Matthew Heon 33845f8a0f Unconditionally refresh storage options from config
Due to our unconditionally setting some storage options, we
are not always reading storage options from storage.conf. This
can lead to some fields in the storage config (most notably extra
storage options) being ignored, despite being set in
storage.conf.

Resolve this by unconditionally refreshing our storage config
from storage.conf (this was previously only done for rootless
Podman)

Fixes #2217

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-06 10:01:43 -05:00
Matthew Heon 2fe6ada854 Use defaults if paths are not specified in storage.conf
For rootless Podman, if storage.conf exists but does not specify
one or both of RunRoot and GraphRoot, set them to rootless
defaults so we don't end up with an unusable configuration.

Fixes #2125

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-01-10 13:19:51 -05:00
OpenShift Merge Robot 4f19f1afca
Merge pull request #2076 from rhatdan/storage.conf
If local storage file exists, then use it rather then defau…
2019-01-08 05:55:40 -08:00
Daniel J Walsh b367855d5f
Add the configuration file used to setup storage to podman info
Users have no idea what storage configuration file is used to setup
storage, so adding this to podman info, should make it easier to
discover.

This requires a revendor of containers/storage

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-07 10:02:26 -05:00
Daniel J Walsh b0fcd555db
If local storage file exists, then use it rather then defaults.
Currently we always force overlay if it exists even though a user might want
vfs.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-03 16:25:02 -05:00
Šimon Lukašík 4e85f468fc Refactor: use idtools.ParseIDMap instead of bundling own version
ParseIDMap function was extracted to idtools in

    https://github.com/containers/storage/pull/236

it is already used in containers/storage and buildah, it should be used in
libpod as well.

Signed-off-by: Šimon Lukašík <isimluk@fedoraproject.org>
2018-12-23 12:07:54 +01:00
umohnani8 4c70b8a94b Add "podman volume" command
Add support for podman volume and its subcommands.
The commands supported are:
	podman volume create
	podman volume inspect
	podman volume ls
	podman volume rm
	podman volume prune

This is a tool to manage volumes used by podman. For now it only handle
named volumes, but eventually it will handle all volumes used by podman.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2018-12-06 10:17:16 +00:00
Matthew Heon 795fbba769 Revert changes to GetDefaultStoreOptions
We don't need this for anything more than rootless work in Libpod
now, but Buildah still uses it as it was originally written, so
leave it intact as part of our API.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-03 15:48:20 -05:00
Matthew Heon b104a45f35 Fix gofmt and lint
Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-02 16:53:15 -05:00
Matthew Heon 562fa57dc9 Move rootless storage config into libpod
Previous commits ensured that we would use database-configured
paths if not explicitly overridden.

However, our runtime generation did unconditionally override
storage config, which made this useless.

Move rootless storage configuration setup to libpod, and change
storage setup so we only override if a setting is explicitly
set, so we can still override what we want.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-02 15:21:35 -05:00
Giuseppe Scrivano 078cb630d3
rootless: store only subset of storage.conf
do not store the entire file but only the subset of what we have
modified.  Also, we were not writing the correct data.  Since it is
not trivial to serialize storage.conf correctly and all the various
supported options, serialize only what we care about.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-28 10:48:30 +01:00
Giuseppe Scrivano 937eb8413c
rootless: create storage.conf when it doesn't exist
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-19 12:11:06 +01:00
Giuseppe Scrivano c7926aa7ca
rootless: default to fuse-overlayfs when available
If fuse-overlayfs is present, rootless containers default to use it.
This can still be overriden either via the command line with
--storage-driver or in the ~/.config/containers/storage.conf
configuration file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-08 10:58:49 +01:00
Giuseppe Scrivano 89e9067dec
rootless: do not add an additional /run to runroot
we are currently using something like /run/user/UID/run as runroot, as
it is already done by Buildah.  This ends up with
/run/user/UID/run/runc for the runc directory.  Change to drop the
additional /run so that runc will use /run/user/UID/runc.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-10-31 13:58:55 +01:00
Daniel J Walsh 3157595288
Fix man page to show info on storage
Also fix lint errors.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-22 16:16:54 -04:00
Daniel J Walsh 2444ac9926
Move rootless directory handling to the libpod/pkg/util directory
This should allow us to share this code with buildah.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-22 09:43:59 -04:00
Giuseppe Scrivano be66361e08 podman: provide a default UID mapping when non root
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Daniel J Walsh a9e9fd4f5b If user specifies UIDMapSlice without GIDMapSlice, set them equal
We need to map slices set for both UID and GID maps to be equivalent if
not specified by user.  Currently if you do not specify both the containers
are not running.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #865
Approved by: baude
2018-05-31 22:30:16 +00:00
Daniel J Walsh b51d737998 Begin wiring in USERNS Support into podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #690
Approved by: mheon
2018-05-04 17:15:55 +00:00
baude 39a7a773a6 varlink images
implement varlink image functions for working with libpod with the exception of a
couple due to incompletions on the libpod side of things (build).

also, created a first pass at a libpodpy package which will stand as a client to
working with libpod's varlink methods using python.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #669
Approved by: baude
2018-04-26 19:14:44 +00:00
baude b85b217f55 Stage3 Image Library
This represents the stage3 implementation for the image library.  At this point, we
are moving the image-centric functions to pkg/image including migration of args and
object-oriented references.  This is a not a one-for-one migration of funcs and some
funcs will need to continue to reside in runtime_img as they are overly specific to
libpod and probably not useful to others.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #484
Approved by: baude
2018-03-14 20:21:31 +00:00
TomSweeneyRedHat bb37c11651 Change un/pwd handling to match Buildah's
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2018-02-06 09:29:23 -05:00