Prechádzať zdrojové kódy

respect both config and container_config

to be honest it's not clear what container_config is - maybe a
deprecated field? looks like we should be using 'config' as a few images
i've tried have only specified things there.
Alex Suraci 7 rokov pred
rodič
commit
3ed6ba7870
1 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 8 2
      cmd/in/main.go

+ 8 - 2
cmd/in/main.go

@@ -130,9 +130,15 @@ func rootfsFormat(dest string, req InRequest, image v1.Image) {
 		return
 	}
 
+	env := append(cfg.Config.Env, cfg.ContainerConfig.Env...)
+	user := cfg.Config.User
+	if user == "" {
+		user = cfg.ContainerConfig.User
+	}
+
 	err = json.NewEncoder(meta).Encode(ImageMetadata{
-		Env:  cfg.ContainerConfig.Env,
-		User: cfg.ContainerConfig.User,
+		Env:  env,
+		User: user,
 	})
 	if err != nil {
 		logrus.Errorf("failed to write image metadata: %s", err)