github.com/zhouyu0/docker-note@v0.0.0-20190722021225-b8d3825084db/pkg/chrootarchive/chroot_unix.go (about)

     1  // +build !windows,!linux
     2  
     3  package chrootarchive // import "github.com/docker/docker/pkg/chrootarchive"
     4  
     5  import "golang.org/x/sys/unix"
     6  
     7  func chroot(path string) error {
     8  	if err := unix.Chroot(path); err != nil {
     9  		return err
    10  	}
    11  	return unix.Chdir("/")
    12  }