Docker cp handles resolv.conf, hostname & hosts, fixes #9998

Add a integration test TestCpSpecialFiles

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2015-03-29 22:10:14 +02:00
parent 1f27ebc2c7
commit 8bc330d863
2 changed files with 75 additions and 0 deletions
+11
View File
@@ -944,6 +944,17 @@ func (container *Container) Copy(resource string) (io.ReadCloser, error) {
}
}
// Check if this is a special one (resolv.conf, hostname, ..)
if resource == "etc/resolv.conf" {
basePath = container.ResolvConfPath
}
if resource == "etc/hostname" {
basePath = container.HostnamePath
}
if resource == "etc/hosts" {
basePath = container.HostsPath
}
stat, err := os.Stat(basePath)
if err != nil {
container.Unmount()