瀏覽代碼

Merge pull request #47048 from thaJeztah/fix_version_output

daemon/config: setPlatformDefaults: use debug for missing userland-proxy
Sebastiaan van Stijn 1 年之前
父節點
當前提交
0fb6ba4ccc
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 1 0
      cmd/dockerd/docker.go
  2. 7 3
      daemon/config/config_linux.go

+ 1 - 0
cmd/dockerd/docker.go

@@ -19,6 +19,7 @@ import (
 var honorXDG bool
 var honorXDG bool
 
 
 func newDaemonCommand() (*cobra.Command, error) {
 func newDaemonCommand() (*cobra.Command, error) {
+	// FIXME(thaJeztah): config.New also looks up default binary-path, but this code is also executed when running "--version".
 	cfg, err := config.New()
 	cfg, err := config.New()
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err

+ 7 - 3
daemon/config/config_linux.go

@@ -251,13 +251,17 @@ func setPlatformDefaults(cfg *Config) error {
 		var err error
 		var err error
 		cfg.BridgeConfig.UserlandProxyPath, err = exec.LookPath(userlandProxyBinary)
 		cfg.BridgeConfig.UserlandProxyPath, err = exec.LookPath(userlandProxyBinary)
 		if err != nil {
 		if err != nil {
-			// Log a warning, but don't error here. This allows running a daemon
-			// with userland-proxy disabled (which does not require the binary
+			// Log, but don't error here. This allows running a daemon with
+			// userland-proxy disabled (which does not require the binary
 			// to be present).
 			// to be present).
 			//
 			//
 			// An error is still produced by [Config.ValidatePlatformConfig] if
 			// An error is still produced by [Config.ValidatePlatformConfig] if
 			// userland-proxy is enabled in the configuration.
 			// userland-proxy is enabled in the configuration.
-			log.G(context.TODO()).WithError(err).Warn("failed to lookup default userland-proxy binary")
+			//
+			// We log this at "debug" level, as this code is also executed
+			// when running "--version", and we don't want to print logs in
+			// that case..
+			log.G(context.TODO()).WithError(err).Debug("failed to lookup default userland-proxy binary")
 		}
 		}
 		cfg.Root = "/var/lib/docker"
 		cfg.Root = "/var/lib/docker"
 		cfg.ExecRoot = "/var/run/docker"
 		cfg.ExecRoot = "/var/run/docker"