mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-28 00:50:11 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user