mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Merge pull request #13865 from Mic92/zfs-selinux
zfs: correctly apply selinux context
This commit is contained in:
		
						commit
						cada9b54b5
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -17,6 +17,7 @@ import (
 | 
			
		|||
	"github.com/docker/docker/daemon/graphdriver"
 | 
			
		||||
	"github.com/docker/docker/pkg/mount"
 | 
			
		||||
	"github.com/docker/docker/pkg/parsers"
 | 
			
		||||
	"github.com/docker/libcontainer/label"
 | 
			
		||||
	zfs "github.com/mistifyio/go-zfs"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -268,14 +269,15 @@ func (d *Driver) Remove(id string) error {
 | 
			
		|||
func (d *Driver) Get(id, mountLabel string) (string, error) {
 | 
			
		||||
	mountpoint := d.MountPath(id)
 | 
			
		||||
	filesystem := d.ZfsPath(id)
 | 
			
		||||
	log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, mountLabel)
 | 
			
		||||
	options := label.FormatMountLabel("", mountLabel)
 | 
			
		||||
	log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, options)
 | 
			
		||||
 | 
			
		||||
	// Create the target directories if they don't exist
 | 
			
		||||
	if err := os.MkdirAll(mountpoint, 0755); err != nil && !os.IsExist(err) {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err := mount.Mount(filesystem, mountpoint, "zfs", mountLabel)
 | 
			
		||||
	err := mount.Mount(filesystem, mountpoint, "zfs", options)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", fmt.Errorf("error creating zfs mount of %s to %s: %v", filesystem, mountpoint, err)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue