Signed-off-by: Anda Xu <anda.xu@docker.com>
| ... | ... |
@@ -64,6 +64,16 @@ var skipValidateOptions = map[string]bool{
|
| 64 | 64 |
"features": true, |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 |
+// skipDuplicates contains configuration keys that |
|
| 68 |
+// will be skipped when checking duplicated |
|
| 69 |
+// configuration field defined in both daemon |
|
| 70 |
+// config file and from dockerd cli flags. |
|
| 71 |
+// This allows some configurations to be merged |
|
| 72 |
+// during the parsing. |
|
| 73 |
+var skipDuplicates = map[string]bool{
|
|
| 74 |
+ "runtimes": true, |
|
| 75 |
+} |
|
| 76 |
+ |
|
| 67 | 77 |
// LogConfig represents the default log configuration. |
| 68 | 78 |
// It includes json tags to deserialize configuration from a file |
| 69 | 79 |
// using the same names that the flags in the command line use. |
| ... | ... |
@@ -491,13 +501,13 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
|
| 491 | 491 |
duplicatedConflicts := func(f *pflag.Flag) {
|
| 492 | 492 |
// search option name in the json configuration payload if the value is a named option |
| 493 | 493 |
if namedOption, ok := f.Value.(opts.NamedOption); ok {
|
| 494 |
- if optsValue, ok := config[namedOption.Name()]; ok {
|
|
| 494 |
+ if optsValue, ok := config[namedOption.Name()]; ok && !skipDuplicates[namedOption.Name()] {
|
|
| 495 | 495 |
conflicts = append(conflicts, printConflict(namedOption.Name(), f.Value.String(), optsValue)) |
| 496 | 496 |
} |
| 497 | 497 |
} else {
|
| 498 | 498 |
// search flag name in the json configuration payload |
| 499 | 499 |
for _, name := range []string{f.Name, f.Shorthand} {
|
| 500 |
- if value, ok := config[name]; ok {
|
|
| 500 |
+ if value, ok := config[name]; ok && !skipDuplicates[name] {
|
|
| 501 | 501 |
conflicts = append(conflicts, printConflict(name, f.Value.String(), value)) |
| 502 | 502 |
break |
| 503 | 503 |
} |