Commit Graph

15 Commits

Author SHA1 Message Date
Matthew Heon c0a124ea89 Allow --ro=[true|false] with mount flag
The 'podman run --mount' flag previously allowed the 'ro' option
to be specified, but was missing the ability to set it to a bool
(as is allowed by docker). Add that. While we're at it, allow
setting 'rw' explicitly as well.

Fixes #2980

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-07 10:03:01 -04:00
Daniel J Walsh e7aca5568a
Use buildah/pkg/parse volume parsing rather then internal version
We share this code with buildah, so we should eliminate the podman
version.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-08-01 03:48:16 -04:00
Qi Wang f50f91079a fix bug convert volume host path to absolute
fix #3504 If --volume host:dest host is not a named volume, convert the host to a absolute directory path.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-07-10 10:26:57 -04:00
Matthew Heon 30f24bb760 Add tests for cached and delegated mounts
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-19 09:57:33 -04:00
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
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 97f4818ce1
storage: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-13 11:29:07 +02:00
Matthew Heon c520e34ea7 Do not set tmpcopyup on /dev
Fixes #3229

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-30 14:02:14 -04:00
Matthew Heon 57e38e9550 When superceding mounts, check for opposite types
When we supercede low-priority mounts and volumes (image volumes,
and volumes sourced from --volumes-from) with higher-priority
ones (the --volume and --mount flags), we always replaced
lower-priority mounts of the same type (e.g. a user mount to
/tmp/test1 would supercede a volumes-from mount to the same
destination). However, we did not supercede the opposite type - a
named volume from image volumes at /tmp/test1 would be allowed to
remain and create a conflict, preventing container creation.

Solve this by destroying opposite types before merging (we can't
do it in the same loop, as then named volumes, which go second,
might trample changes made by mounts).

Fixes #3174

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-21 10:21:21 -04:00
Matthew Heon 606cee93bf Move handling of ReadOnlyTmpfs into new mounts code
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -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
Matthew Heon 2698c82240 Add options parsing for tmpfs mounts
This ensures that all tmpfs mounts added by the user, even with
the --mount flag, share a few common options (nosuid, noexec,
nodev), and options for tmpfs mounts are properly validated to
ensure they are correct.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -04:00
Matthew Heon 13451cab5c Hit a number of to-do comments in unified volumes code
As part of this, move bind mount option validity parsing and
modification (adding e.g. rbind on bind mounts that are missing
it), which requires test changes (expected values have changed).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -04:00
Matthew Heon 70beb57faa Fix options for non-bind and non-tmpfs volumes
We were unconditionally resetting volume mount options for all
mount points (and by the looks of things, completely dropping
tmpfs mounts), which was causing runc to refuse to run containers
and all the tests to consequently fail.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -04:00
Matthew Heon 9ee50fe2c7 Migrate to unified volume handling code
Unify handling for the --volume, --mount, --volumes-from, --tmpfs
and --init flags into a single file and set of functions. This
will greatly improve readability and maintainability.

Further, properly handle superceding and conflicting mounts. Our
current patchwork has serious issues when mounts conflict, or
when a mount from --volumes-from or an image volume should be
overwritten by a user volume or named volume.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 10:19:05 -04:00