diff --git a/daemon/container.go b/daemon/container.go index 57b3684d4d..b2782ee22b 100644 --- a/daemon/container.go +++ b/daemon/container.go @@ -139,7 +139,11 @@ func (container *Container) WriteHostConfig() (err error) { func (container *Container) getResourcePath(path string) string { cleanPath := filepath.Join("/", path) - return filepath.Join(container.basefs, cleanPath) + result, err := symlink.FollowSymlinkInScope(filepath.Join(container.basefs, cleanPath), container.basefs) + if err != nil { + utils.Errorf("getResourcePath failed: %v", err) + } + return result } func (container *Container) getRootResourcePath(path string) string { diff --git a/daemon/volumes.go b/daemon/volumes.go index d9719369ac..262e8c61ee 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -280,8 +280,8 @@ func initializeVolume(container *Container, volPath string, binds map[string]Bin delete(container.VolumesRW, volPath) } - container.Volumes[newVolPath] = destination - container.VolumesRW[newVolPath] = srcRW + container.Volumes[volPath] = destination + container.VolumesRW[volPath] = srcRW if err := createIfNotExists(source, volIsDir); err != nil { return err