зеркало из https://github.com/microsoft/docker.git
Windows: Refactor volumes
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
Родитель
8dc07af52f
Коммит
ba1725a94e
|
@ -13,7 +13,6 @@ import (
|
||||||
"github.com/docker/docker/pkg/chrootarchive"
|
"github.com/docker/docker/pkg/chrootarchive"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
"github.com/docker/docker/pkg/symlink"
|
||||||
"github.com/docker/docker/pkg/system"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type volumeMount struct {
|
type volumeMount struct {
|
||||||
|
@ -314,21 +313,6 @@ func copyExistingContents(source, destination string) error {
|
||||||
return copyOwnership(source, destination)
|
return copyOwnership(source, destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
// copyOwnership copies the permissions and uid:gid of the source file
|
|
||||||
// into the destination file
|
|
||||||
func copyOwnership(source, destination string) error {
|
|
||||||
stat, err := system.Stat(source)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Chown(destination, int(stat.Uid()), int(stat.Gid())); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return os.Chmod(destination, os.FileMode(stat.Mode()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (container *Container) mountVolumes() error {
|
func (container *Container) mountVolumes() error {
|
||||||
for dest, source := range container.Volumes {
|
for dest, source := range container.Volumes {
|
||||||
v := container.daemon.volumes.Get(source)
|
v := container.daemon.volumes.Get(source)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/system"
|
||||||
|
)
|
||||||
|
|
||||||
|
// copyOwnership copies the permissions and uid:gid of the source file
|
||||||
|
// into the destination file
|
||||||
|
func copyOwnership(source, destination string) error {
|
||||||
|
stat, err := system.Stat(source)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Chown(destination, int(stat.Uid()), int(stat.Gid())); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.Chmod(destination, os.FileMode(stat.Mode()))
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
// Not supported on Windows
|
||||||
|
func copyOwnership(source, destination string) error {
|
||||||
|
return nil
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче