enable dns w/ docker
This commit is contained in:
		
							parent
							
								
									be274cf2e9
								
							
						
					
					
						commit
						678550e68f
					
				
							
								
								
									
										9
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.go
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ type Docker struct { | |||||||
| 	Repo     string   `json:"repo"` | 	Repo     string   `json:"repo"` | ||||||
| 	Tag      string   `json:"tag"` | 	Tag      string   `json:"tag"` | ||||||
| 	File     string   `json:"file"` | 	File     string   `json:"file"` | ||||||
|  | 	Dns      []string `json:"dns"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func main() { | func main() { | ||||||
| @ -55,12 +56,16 @@ func main() { | |||||||
| 		cmd.Stderr = ioutil.Discard | 		cmd.Stderr = ioutil.Discard | ||||||
| 		cmd.Run() | 		cmd.Run() | ||||||
| 
 | 
 | ||||||
| 		args := []string{"-d", "-s", vargs.Storage} | 		args := []string{"daemon", "-s", vargs.Storage} | ||||||
| 
 | 
 | ||||||
| 		if vargs.Insecure && len(vargs.Registry) != 0 { | 		if vargs.Insecure && len(vargs.Registry) != 0 { | ||||||
| 			args = append(args, "--insecure-registry", vargs.Registry) | 			args = append(args, "--insecure-registry", vargs.Registry) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		for _, value := range vargs.Dns { | ||||||
|  | 			args = append(args, "--dns", value) | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		cmd = exec.Command("docker", args...) | 		cmd = exec.Command("docker", args...) | ||||||
| 		cmd.Stdout = ioutil.Discard | 		cmd.Stdout = ioutil.Discard | ||||||
| 		cmd.Stderr = ioutil.Discard | 		cmd.Stderr = ioutil.Discard | ||||||
| @ -74,6 +79,8 @@ func main() { | |||||||
| 	// Set the Registry value
 | 	// Set the Registry value
 | ||||||
| 	if len(vargs.Registry) == 0 { | 	if len(vargs.Registry) == 0 { | ||||||
| 		vargs.Registry = "https://index.docker.io/v1/" | 		vargs.Registry = "https://index.docker.io/v1/" | ||||||
|  | 	} else { | ||||||
|  | 		vargs.Repo = fmt.Sprintf("%s/%s", vargs.Registry, vargs.Repo) | ||||||
| 	} | 	} | ||||||
| 	// Set the Dockerfile path
 | 	// Set the Dockerfile path
 | ||||||
| 	if len(vargs.File) == 0 { | 	if len(vargs.File) == 0 { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Brad Rydzewski
						Brad Rydzewski