Signed-off-by: allencloud <allen.sun@daocloud.io>
| ... | ... |
@@ -25,7 +25,7 @@ func (r ContainerDecoder) DecodeHostConfig(src io.Reader) (*container.HostConfig |
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
// DecodeContainerConfig decodes a json encoded config into a ContainerConfigWrapper |
| 28 |
-// struct and returns both a Config and an HostConfig struct |
|
| 28 |
+// struct and returns both a Config and a HostConfig struct |
|
| 29 | 29 |
// Be aware this function is not checking whether the resulted structs are nil, |
| 30 | 30 |
// it's your business to do so |
| 31 | 31 |
func DecodeContainerConfig(src io.Reader) (*container.Config, *container.HostConfig, *networktypes.NetworkingConfig, error) {
|
| ... | ... |
@@ -47,7 +47,7 @@ func doesEnvExist(name string) bool {
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
// ValidateExtraHost validates that the specified string is a valid extrahost and returns it. |
| 50 |
-// ExtraHost are in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6). |
|
| 50 |
+// ExtraHost is in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6). |
|
| 51 | 51 |
func ValidateExtraHost(val string) (string, error) {
|
| 52 | 52 |
// allow for IPv6 addresses in extra hosts by only splitting on first ":" |
| 53 | 53 |
arr := strings.SplitN(val, ":", 2) |
| ... | ... |
@@ -150,7 +150,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host |
| 150 | 150 |
if *flStdin {
|
| 151 | 151 |
attachStdin = true |
| 152 | 152 |
} |
| 153 |
- // If -a is not set attach to the output stdio |
|
| 153 |
+ // If -a is not set, attach to stdout and stderr |
|
| 154 | 154 |
if flAttach.Len() == 0 {
|
| 155 | 155 |
attachStdout = true |
| 156 | 156 |
attachStderr = true |
| ... | ... |
@@ -246,7 +246,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host |
| 246 | 246 |
// Validate if the given hostname is RFC 1123 (https://tools.ietf.org/html/rfc1123) compliant. |
| 247 | 247 |
hostname := *flHostname |
| 248 | 248 |
if hostname != "" {
|
| 249 |
- // Linux hostname is limited to HOST_NAME_MAX=64, not not including the terminating null byte. |
|
| 249 |
+ // Linux hostname is limited to HOST_NAME_MAX=64, not including the terminating null byte. |
|
| 250 | 250 |
matched, _ := regexp.MatchString("^(([[:alnum:]]|[[:alnum:]][[:alnum:]\\-]*[[:alnum:]])\\.)*([[:alnum:]]|[[:alnum:]][[:alnum:]\\-]*[[:alnum:]])$", hostname)
|
| 251 | 251 |
if len(hostname) > 64 || !matched {
|
| 252 | 252 |
return nil, nil, nil, cmd, fmt.Errorf("invalid hostname format for --hostname: %s", hostname)
|
| ... | ... |
@@ -473,7 +473,8 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host |
| 473 | 473 |
return config, hostConfig, networkingConfig, cmd, nil |
| 474 | 474 |
} |
| 475 | 475 |
|
| 476 |
-// reads a file of line terminated key=value pairs and override that with override parameter |
|
| 476 |
+// reads a file of line terminated key=value pairs, and overrides any keys |
|
| 477 |
+// present in the file with additional pairs specified in the override parameter |
|
| 477 | 478 |
func readKVStrings(files []string, override []string) ([]string, error) {
|
| 478 | 479 |
envVariables := []string{}
|
| 479 | 480 |
for _, ef := range files {
|
| ... | ... |
@@ -539,7 +540,7 @@ func parseSecurityOpts(securityOpts []string) ([]string, error) {
|
| 539 | 539 |
return securityOpts, nil |
| 540 | 540 |
} |
| 541 | 541 |
|
| 542 |
-// parse storage options per container into a map |
|
| 542 |
+// parses storage options per container into a map |
|
| 543 | 543 |
func parseStorageOpts(storageOpts []string) (map[string]string, error) {
|
| 544 | 544 |
m := make(map[string]string) |
| 545 | 545 |
for _, option := range storageOpts {
|
| ... | ... |
@@ -640,7 +641,7 @@ func ParseLink(val string) (string, string, error) {
|
| 640 | 640 |
if len(arr) == 1 {
|
| 641 | 641 |
return val, val, nil |
| 642 | 642 |
} |
| 643 |
- // This is kept because we can actually get an HostConfig with links |
|
| 643 |
+ // This is kept because we can actually get a HostConfig with links |
|
| 644 | 644 |
// from an already created container and the format is not `foo:bar` |
| 645 | 645 |
// but `/foo:/c1/bar` |
| 646 | 646 |
if strings.HasPrefix(arr[0], "/") {
|