github.com/adityamillind98/moby@v23.0.0-rc.4+incompatible/daemon/archive_unix.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package daemon // import "github.com/docker/docker/daemon"
     5  
     6  import (
     7  	"github.com/docker/docker/container"
     8  	volumemounts "github.com/docker/docker/volume/mounts"
     9  )
    10  
    11  // checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
    12  // cannot be in a read-only volume. If it  is not in a volume, the container
    13  // cannot be configured with a read-only rootfs.
    14  func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
    15  	var toVolume bool
    16  	parser := volumemounts.NewParser()
    17  	for _, mnt := range container.MountPoints {
    18  		if toVolume = parser.HasResource(mnt, absPath); toVolume {
    19  			if mnt.RW {
    20  				break
    21  			}
    22  			return false, ErrVolumeReadonly
    23  		}
    24  	}
    25  	return toVolume, nil
    26  }
    27  
    28  // isOnlineFSOperationPermitted returns an error if an online filesystem operation
    29  // is not permitted.
    30  func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
    31  	return nil
    32  }