Skip to content

Commit 65d05f3

Browse files
Merge pull request #21050 from mfojtik/11-fix-cluster-up
Issue #20985 Don't mount the docker/config.json if file doesn't exist
2 parents 36b3fc2 + 7b1772c commit 65d05f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/oc/clusterup/run_self_hosted.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,10 @@ func (c *ClusterUpConfig) startKubelet(out io.Writer, masterConfigDir, nodeConfi
503503
} else if currentUser, err := user.Current(); err == nil {
504504
var cfgPath string
505505
cfgPath = filepath.Join(currentUser.HomeDir, ".docker", "config.json")
506-
container.ContainerBinds = append(container.ContainerBinds, fmt.Sprintf("%s:/root/.docker/config.json", cfgPath))
507-
glog.Infof("docker config path %s", cfgPath)
506+
// First check if config file exist on the host before add it to the mounts.
507+
if _, err := os.Stat(cfgPath); !os.IsNotExist(err) {
508+
container.ContainerBinds = append(container.ContainerBinds, fmt.Sprintf("%s:/root/.docker/config.json", cfgPath))
509+
}
508510
}
509511
// Kubelet needs to be able to write to
510512
// /sys/devices/virtual/net/vethXXX/brport/hairpin_mode, so make this rw, not ro.

0 commit comments

Comments
 (0)