Merge pull request #664 from tonistiigi/clean-config

executor: clean up static config files
docker-18.09
Tibor Vass 2018-10-03 15:40:33 -07:00 committed by GitHub
commit f07efb78e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package containerdexecutor
import (
"context"
"io"
"os"
"path/filepath"
"strings"
"syscall"
@ -33,6 +34,10 @@ type containerdExecutor struct {
// New creates a new executor backed by connection to containerd API
func New(client *containerd.Client, root, cgroup string, networkProviders map[pb.NetMode]network.Provider) executor.Executor {
// clean up old hosts/resolv.conf file. ignore errors
os.RemoveAll(filepath.Join(root, "hosts"))
os.RemoveAll(filepath.Join(root, "resolv.conf"))
return containerdExecutor{
client: client,
root: root,

View File

@ -85,6 +85,10 @@ func New(opt Opt, networkProviders map[pb.NetMode]network.Provider) (executor.Ex
return nil, err
}
// clean up old hosts/resolv.conf file. ignore errors
os.RemoveAll(filepath.Join(root, "hosts"))
os.RemoveAll(filepath.Join(root, "resolv.conf"))
runtime := &runc.Runc{
Command: cmd,
Log: filepath.Join(root, "runc-log.json"),