Commit Graph

24 Commits

Author SHA1 Message Date
Kir Kolyshkin d53aa83fd2 vendor: bump mountinfo to v0.3.1
Unfortunately it contains some breaking changes (in names),
so fix the code accordingly.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-01 17:59:49 -07:00
Steven Armstrong 818a08d79c prevent chown on read-only mountpoint
- filter the 'ro' mount flag
- mount read-write to allow setting permissions
- then remount read-only if 'ro' flag was given

fixes #602

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>
Co-Authored-By: Sascha Grunert <sgrunert@suse.com>
2020-04-30 11:44:18 +02:00
Sascha Grunert d88ef6dc08
Enable goimports linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Nalin Dahyabhai 026db3c2bd drivers: make Init() take a graphdriver.Config
Instead of passing the driver-specific directory and assorted fields
from a Config struct to lower-level drivers when we initialize them,
pass them the directory and the Config struct.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-06-20 11:38:33 -04:00
Daniel J Walsh ef42340c2e
Revert "Add MountTempFromSource and RemoveTemp interfaces"
This reverts commit e9695564db.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-02 11:54:55 -04:00
Daniel J Walsh e9695564db
Add MountTempFromSource and RemoveTemp interfaces
These interfaces can be used to setup a graphdriver mountpoint
of the source directory for use within a container.
The RemoveTemp interface umounts the mountpoint and then removes
all of the modified data in the graphdriver for this source directory.

The primary use case of these interfaces is for container engines that
want to mount a directory from the host system into the container. The
source dirctory then can be modified without actually changing the
directory on the host.

Containers will use these interfaces for sharing packaing cache directories
like /var/cache/dnf, to help speed up container builds.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-04-29 14:46:40 -04:00
Nalin Dahyabhai c073b43547 Add a CreateFromTemplate() method to drivers, and use it for mapped layers
Add a CreateFromTemplate() method to graph drivers, and use it instead
of a driver-oblivious diff/put method when we want to create a copy of
an image's top layer that has the same parent and which differs from the
original only in its ID maps.

This lets drivers that can quickly make an independent layer based on
another layer do something smarter than we were doing with the
driver-oblivious method.  For some drivers, a native method is
dramatically faster.

Note that the driver needs to be able to do this while still exposing
just one notional layer (i.e., one link in the chain of layers for a
given container) to the higher levels of the APIs, so if the new layer
is actually a child of the template layer, that needs to remain a detail
that's private to the driver.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-01-17 14:28:40 -05:00
Daniel J Walsh 92c7d3b0bb
Remove mounts private from zfs, it is causing issues on reboot with zfs
This was originally put in to prevent potential leaks of mount points to
different mount namespaces.  Lets remove it and fix the issue with
zfs, and see if we experience leaked mounts.  oci-umount should also
clean up any leaks, if installed.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-16 06:28:00 -05:00
Daniel J Walsh 53126cfd67
Update zfs driver to be closer to moby driver
There is a bug report reporting issues on zfs driver on reboot.
Wanted to make sure we have close to the same code as the Moby Project.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-14 17:29:41 -05:00
Daniel J Walsh ab6be50561
Allow the passing in and retrieval of mount options
We want to allow tools like podman/buildah to override default storage
container mount options on a container by container basis.

For example if the default mount options for containers/storage include
nodev or nosuid, we want to allow podman to turn these off if the user
specifies --privileged.

We also might want to turn off certain user namespace flags that will cause
buildah and podman build to work slower when creating container images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-19 19:14:21 -05:00
Šimon Lukašík 3cabc9ac3c Fix file permission on /dev/zfs creation
Fixing typo in constant from 01130 (600) to 0600.

Signed-off-by: Šimon Lukašík <slukasik@redhat.com>
2018-11-05 18:04:52 +01:00
Daniel J Walsh b6ccc0acfa
Add MountOpts to stop adding fields to Get Interface
This patch adds a MountOpts field to the drivers so we can simplify
the interface to Get and allow additional options to be passed in the future.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-05 09:23:46 -04:00
Giuseppe Scrivano 1897396330
drivers: inform Mount of the mappings used by the container
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-26 06:12:42 +02:00
Daniel J Walsh 8b1a0f8d68
Add default mount options to pass to drivers
I believe we should be running container images mounted with nodev by default.
This would eliminate the disk of a device sneaking into the container without
being on the approved list.  This would give us the same or potentially additional
security over the device cgroup.

It would be nice if this could be passed in on an image by image basis.  So users
could also specify if they want nosuid images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-07-18 10:20:27 -04:00
Nalin Dahyabhai 97326e1d2f Support for per-container uid/gid mapping: lower
Expose reading and writing ID mapping in the archive and chrootarchive
packages, and in the driver interface.  Generally this means that
when computing or applying diffs, we need to have ID mappings passed in
that are specific to the layers we're using.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai b71d4c4197 Support for per-container uid/gid mapping: upper
Add support to the Store objects for per-container UID/GID mapping.
* UID and GID maps can be specified when creating layers and containers.
* If mapping options are specified when creating a container, those
  options are used for creating the layer which we create for the
  container and recorded with the container for convenience.
* A layer defaults to using the ID mapping configured for its parent, or
  to the default which was used to initialize the Store object if it has
  no parent.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Daniel J Walsh 4c6ff0eef1 Backport moby zfs changes to containers/storage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-26 20:45:15 +00:00
Mrunal Patel 59da502256 Update deps to github.com/sirupsen/logrus v1.0.0
Also updates github.com/Microsoft/hcsshim
and github.com/docker/go-connections so they work
with the newer version of logrus.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-01 07:25:56 -07:00
Nalin Dahyabhai 5375906c2e Wrap some driver-level errors
Wrap graphdriver.{ErrNotSupported,ErrPrerequisites,ErrIncompatibleFS}
errors in contexts using github.com/pkg/errors, and dig them out for
comparison using errors.Cause().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-10 14:48:46 -04:00
Dan Walsh 1624d9622b Fix container storage to support additional image stores
We want to support additional read/only image stores available on
file systems.  Usually these images stores would be on network shares.
Currently the only driver that will support additional images is the
overlay file system.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-05-20 12:18:51 -04:00
Dan Walsh 473f49f004 Remove Get prefix on method calls.
Go validate suggests that you should not use functions that begin with Get,
unless you have to.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-05-10 11:04:46 -04:00
Daniel J Walsh 79a5d04c2f Switch to using opencontainers/selinux
We have moved runc/libcontainers selinux support out of libcontainer
into opencontainers/selinux.  Switching containers/storage to use
new interfaces.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-22 14:12:48 -04:00
Nalin Dahyabhai 128f8c975c Don't mask unmount errors in overlay,overlay2,zfs
The overlay, overlay2, and zfs drivers masked unmount errors in their
Put() methods.  Bring them in line with the others and actually return
the error code.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-08-22 13:41:20 -04:00
Nalin Dahyabhai 60ff079996 Rename: cow/cowman -> storage/oci-storage
Rename the library module and CLI wrapper.
Rename daemon/graphdriver to drivers.
Catch up vendoring to match modules we've pruned.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-07-18 17:35:50 -04:00