2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								package  cli  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// the cli package contains urfave/cli related structs that help make up
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// the command line for buildah commands. it resides here so other projects
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// that vendor in this code can use them too.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  (  
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"fmt" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"os" 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-11 06:21:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"runtime" 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"strings" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/define" 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/pkg/completion" 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-20 19:31:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/pkg/parse" 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 03:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/util" 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-10 03:57:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/common/pkg/auth" 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									commonComp  "github.com/containers/common/pkg/completion" 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-14 20:12:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/common/pkg/config" 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-16 00:21:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/storage/pkg/unshare" 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/opencontainers/runtime-spec/specs-go" 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/pkg/errors" 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/spf13/pflag" 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// LayerResults represents the results of the layer flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  LayerResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ForceRm  bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Layers   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// UserNSResults represents the results for the UserNS flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  UserNSResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNS             string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSUIDMap       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSGIDMap       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSUIDMapUser   string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSGIDMapGroup  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// NameSpaceResults represents the results for Namespace flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  NameSpaceResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									IPC            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Network        string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CNIConfigDir   string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CNIPlugInPath  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PID            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UTS            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-09-07 03:17:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// BudResults represents the results for Bud flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  BudResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Annotation           [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Authfile             string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BuildArg             [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CacheFrom            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CertDir              string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Compress             bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Creds                string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DisableCompression   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DisableContentTrust  bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									IgnoreFile           string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									File                 [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Format               string 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 09:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									From                 string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Iidfile              string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Label                [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Logfile              string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Loglevel             int 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 20:16:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Manifest             string 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NoCache              bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-27 04:56:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Timestamp            int64 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Pull                 bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PullAlways           bool 
							 
						 
					
						
							
								
									
										
											 
										
											
												Fix --pull=true||false and add --pull-never to bud and from (retry)
(Replaces #1873 as it had lint issues that were timing out tests that I couldn't
track down easily)
Prior to this fix, if someone did `buildah bud --pull=false .` and the image in
the Containerfile's FROM statement was not local, the build would fail. The same
build on Docker will succeed. In Docker, when `--pull` is set to false, it only
pulls the image from the registry if there was not one locally. Buildah would never
pull the image and if the image was not locally available, it would throw an error.
In certain Kubernetes environments, this was especially troublesome.
To retain the old `--pull=false` functionality, I've created a new `--pull-never`
option that fails if an image is not locally available just like the old
`--pull=false` option used to do.
In addition, if there was a newer version of the image on the repository than
the one locally, the `--pull=true` option would not pull the image as it should
have, this corrects that.
Changes both the from and bud commands.
Addresses: #1675
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1959
Approved by: rhatdan
											 
										 
										
											2019-10-31 22:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PullNever            bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Quiet                bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rm                   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Runtime              string 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RuntimeFlags         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SignaturePolicy      string 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 01:23:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SignBy               string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Squash               bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 09:56:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Stdin                bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Tag                  [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-03 07:31:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Target               string 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-24 19:55:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TLSVerify            bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-22 16:53:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Jobs                 int 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-25 21:53:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LogRusage            bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// FromAndBugResults represents the results for common flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// in bud and from
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  FromAndBudResults  struct  {  
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AddHost         [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BlobCache       string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CapAdd          [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CapDrop         [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CgroupParent    string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUPeriod       uint64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUQuota        int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUSetCPUs      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUSetMems      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUShares       uint64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DecryptionKeys  [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Devices         [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSSearch       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSServers      [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSOptions      [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HTTPProxy       bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Isolation       string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Memory          string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MemorySwap      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SecurityOpt     [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ShmSize         string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ulimit          [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Volumes         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GetUserNSFlags returns the common flags for usernamespace
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetUserNSFlags ( flags  * UserNSResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNS ,  "userns" ,  "" ,  "'container', `path` of user namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-08 08:28:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringSliceVar ( & flags . UserNSUIDMap ,  "userns-uid-map" ,  [ ] string { } ,  "`containerUID:hostUID:length` UID mapping to use in user namespace" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags . StringSliceVar ( & flags . UserNSGIDMap ,  "userns-gid-map" ,  [ ] string { } ,  "`containerGID:hostGID:length` GID mapping to use in user namespace" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNSUIDMapUser ,  "userns-uid-map-user" ,  "" ,  "`name` of entries from /etc/subuid to use to set user namespace UID mapping" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNSGIDMapGroup ,  "userns-gid-map-group" ,  "" ,  "`name` of entries from /etc/subgid to use to set user namespace GID mapping" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  usernsFlags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetUserNSFlagsCompletions returns the FlagCompletions for the userns flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetUserNSFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns" ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-uid-map" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-gid-map" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-uid-map-user" ]  =  commonComp . AutocompleteSubuidName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-gid-map-group" ]  =  commonComp . AutocompleteSubgidName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetNameSpaceFlags returns the common flags for a namespace menu
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetNameSpaceFlags ( flags  * NameSpaceResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . IPC ,  string ( specs . IPCNamespace ) ,  "" ,  "'private', `path` of IPC namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Network ,  string ( specs . NetworkNamespace ) ,  "" ,  "'private', 'none', 'ns:path' of network namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CNIConfigDir ,  "cni-config-dir" ,  util . DefaultCNIConfigDir ,  "`directory` of CNI configuration files" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CNIPlugInPath ,  "cni-plugin-path" ,  util . DefaultCNIPluginPath ,  "`path` of CNI network plugins" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . PID ,  string ( specs . PIDNamespace ) ,  "" ,  "private, `path` of PID namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . UTS ,  string ( specs . UTSNamespace ) ,  "" ,  "private, :`path` of UTS namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetNameSpaceFlagsCompletions returns the FlagCompletions for the namespace flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetNameSpaceFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . IPCNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . NetworkNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cni-config-dir" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cni-plugin-path" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . PIDNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . UTSNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetLayerFlags returns the common flags for layers
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetLayerFlags ( flags  * LayerResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . ForceRm ,  "force-rm" ,  false ,  "Always remove intermediate containers after a build, even if the build is unsuccessful." ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-22 04:13:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Layers ,  "layers" ,  UseLayers ( ) ,  fmt . Sprintf ( "cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override." ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Note: GetLayerFlagsCompletion is not needed since GetLayerFlags only contains bool flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetBudFlags returns common bud flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetBudFlags ( flags  * BudResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "arch" ,  runtime . GOARCH ,  "set the ARCH of the image to the provided value instead of the architecture of the host" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Annotation ,  "annotation" ,  [ ] string { } ,  "Set metadata for an image (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-10 03:57:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Authfile ,  "authfile" ,  auth . GetDefaultAuthFile ( ) ,  "path of the authentication file." ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-07 23:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . BuildArg ,  "build-arg" ,  [ ] string { } ,  "`argument=value` to supply to the builder" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CacheFrom ,  "cache-from" ,  "" ,  "Images to utilise as potential cache sources. The build process does not currently support caching so this is a NOOP." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CertDir ,  "cert-dir" ,  "" ,  "use certificates at the specified path to access the registry" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Compress ,  "compress" ,  false ,  "This is legacy option, which has no effect on the image" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Creds ,  "creds" ,  "" ,  "use `[username[:password]]` for accessing the registry" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 03:16:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVarP ( & flags . DisableCompression ,  "disable-compression" ,  "D" ,  true ,  "don't compress layers by default" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . DisableContentTrust ,  "disable-content-trust" ,  false ,  "This is a Docker specific option and is a NOOP" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 09:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . From ,  "from" ,  "" ,  "image name used to replace the value in the first FROM instruction in the Containerfile" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . IgnoreFile ,  "ignorefile" ,  "" ,  "path to an alternate .dockerignore file" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVarP ( & flags . File ,  "file" ,  "f" ,  [ ] string { } ,  "`pathname or URL` of a Dockerfile" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Format ,  "format" ,  DefaultFormat ( ) ,  "`format` of the built image's manifest and metadata. Use BUILDAH_FORMAT environment variable to override." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Iidfile ,  "iidfile" ,  "" ,  "`file` to write the image ID to" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . IntVar ( & flags . Jobs ,  "jobs" ,  1 ,  "how many stages to run in parallel" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Label ,  "label" ,  [ ] string { } ,  "Set metadata for an image (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Logfile ,  "logfile" ,  "" ,  "log to `file` instead of stdout/stderr" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . IntVar ( & flags . Loglevel ,  "loglevel" ,  0 ,  "adjust logging level (range from -2 to 3)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . LogRusage ,  "log-rusage" ,  false ,  "log resource usage at each build step" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "log-rusage" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the log-rusage flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 20:16:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Manifest ,  "manifest" ,  "" ,  "add the image to the specified manifest list. Creates manifest if it does not exist" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . NoCache ,  "no-cache" ,  false ,  "Do not use existing cached images for the container build. Build from the start with a new set of cached layers." ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "os" ,  runtime . GOOS ,  "set the OS to the provided value instead of the current operating system of the host" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . String ( "platform" ,  parse . DefaultPlatform ( ) ,  "set the OS/ARCH to the provided value instead of the current operating system and architecture of the host (for example `linux/arm`)" ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Fix --pull=true||false and add --pull-never to bud and from (retry)
(Replaces #1873 as it had lint issues that were timing out tests that I couldn't
track down easily)
Prior to this fix, if someone did `buildah bud --pull=false .` and the image in
the Containerfile's FROM statement was not local, the build would fail. The same
build on Docker will succeed. In Docker, when `--pull` is set to false, it only
pulls the image from the registry if there was not one locally. Buildah would never
pull the image and if the image was not locally available, it would throw an error.
In certain Kubernetes environments, this was especially troublesome.
To retain the old `--pull=false` functionality, I've created a new `--pull-never`
option that fails if an image is not locally available just like the old
`--pull=false` option used to do.
In addition, if there was a newer version of the image on the repository than
the one locally, the `--pull=true` option would not pull the image as it should
have, this corrects that.
Changes both the from and bud commands.
Addresses: #1675
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1959
Approved by: rhatdan
											 
										 
										
											2019-10-31 22:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Pull ,  "pull" ,  true ,  "pull the image from the registry if newer or not present in store, if false, only pull the image if not present" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . PullAlways ,  "pull-always" ,  false ,  "pull the image even if the named image is present in store" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . PullNever ,  "pull-never" ,  false ,  "do not pull the image, use the image present in store if available" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVarP ( & flags . Quiet ,  "quiet" ,  "q" ,  false ,  "refrain from announcing build instructions and image read/write progress" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-22 04:13:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Rm ,  "rm" ,  true ,  "Remove intermediate containers after a successful build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-11 02:01:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// "runtime" definition moved to avoid name collision in podman build.  Defined in cmd/buildah/bud.go.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . RuntimeFlags ,  "runtime-flag" ,  [ ] string { } ,  "add global flags for the container runtime" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 01:23:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SignBy ,  "sign-by" ,  "" ,  "sign the image using a GPG key with the specified `FINGERPRINT`" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SignaturePolicy ,  "signature-policy" ,  "" ,  "`pathname` of signature policy file (not usually used)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "signature-policy" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the signature-policy flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 01:23:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Squash ,  "squash" ,  false ,  "squash newly built layers into a single new layer" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 09:56:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Stdin ,  "stdin" ,  false ,  "pass stdin into containers" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVarP ( & flags . Tag ,  "tag" ,  "t" ,  [ ] string { } ,  "tagged `name` to apply to the built image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-03 07:31:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Target ,  "target" ,  "" ,  "set the target build stage to build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . Int64Var ( & flags . Timestamp ,  "timestamp" ,  0 ,  "set created timestamp to the specified epoch seconds to allow for deterministic builds, defaults to current time" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-24 19:55:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . TLSVerify ,  "tls-verify" ,  true ,  "require HTTPS and verify certificates when accessing the registry" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "variant" ,  "" ,  "override the `variant` of the specified image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetBudFlagsCompletions returns the FlagCompletions for the common bud flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetBudFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "arch" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "annotation" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "authfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "build-arg" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cache-from" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cert-dir" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "creds" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "file" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 09:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "from" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "format" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "ignorefile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "iidfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "jobs" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "label" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "logfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "loglevel" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 20:16:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "manifest" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "os" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "platform" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "runtime-flag" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sign-by" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "signature-policy" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "tag" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "target" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "timestamp" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "variant" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GetFromAndBudFlags returns from and bud flags
  
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  GetFromAndBudFlags ( flags  * FromAndBudResults ,  usernsResults  * UserNSResults ,  namespaceResults  * NameSpaceResults )  ( pflag . FlagSet ,  error )  {  
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									defaultContainerConfig ,  err  :=  config . Default ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  fs ,  errors . Wrapf ( err ,  "failed to get container config" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . AddHost ,  "add-host" ,  [ ] string { } ,  "add a custom host-to-IP mapping (`host:ip`) (default [])" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . BlobCache ,  "blob-cache" ,  "" ,  "assume image blobs in the specified directory will be available for pushing" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 19:46:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "blob-cache" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking net flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . CapAdd ,  "cap-add" ,  [ ] string { } ,  "add the specified capability when running (default [])" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . CapDrop ,  "cap-drop" ,  [ ] string { } ,  "drop the specified capability when running (default [])" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CgroupParent ,  "cgroup-parent" ,  "" ,  "optional parent cgroup for the container" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Uint64Var ( & flags . CPUPeriod ,  "cpu-period" ,  0 ,  "limit the CPU CFS (Completely Fair Scheduler) period" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Int64Var ( & flags . CPUQuota ,  "cpu-quota" ,  0 ,  "limit the CPU CFS (Completely Fair Scheduler) quota" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Uint64VarP ( & flags . CPUShares ,  "cpu-shares" ,  "c" ,  0 ,  "CPU shares (relative weight)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CPUSetCPUs ,  "cpuset-cpus" ,  "" ,  "CPUs in which to allow execution (0-3, 0,1)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CPUSetMems ,  "cpuset-mems" ,  "" ,  "memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems." ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DecryptionKeys ,  "decryption-key" ,  nil ,  "key needed to decrypt the image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 06:15:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Devices ,  "device" ,  defaultContainerConfig . Containers . Devices ,  "Additional devices to be used within containers (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSSearch ,  "dns-search" ,  defaultContainerConfig . Containers . DNSSearches ,  "Set custom DNS search domains" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSServers ,  "dns" ,  defaultContainerConfig . Containers . DNSServers ,  "Set custom DNS servers or disable it completely by setting it to 'none', which prevents the automatic creation of `/etc/resolv.conf`." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSOptions ,  "dns-option" ,  defaultContainerConfig . Containers . DNSOptions ,  "Set custom DNS options" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 00:31:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . HTTPProxy ,  "http-proxy" ,  true ,  "pass through HTTP Proxy environment variables" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Isolation ,  "isolation" ,  DefaultIsolation ( ) ,  "`type` of process isolation to use. Use BUILDAH_ISOLATION environment variable to override." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVarP ( & flags . Memory ,  "memory" ,  "m" ,  "" ,  "memory limit (format: <number>[<unit>], where unit = b, k, m or g)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . MemorySwap ,  "memory-swap" ,  "" ,  "swap limit equal to memory plus swap: '-1' to enable unlimited swap" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "arch" ,  runtime . GOARCH ,  "set the ARCH of the image to the provided value instead of the architecture of the host" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . String ( "os" ,  runtime . GOOS ,  "prefer `OS` instead of the running OS when pulling images" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . String ( "variant" ,  "" ,  "override the `variant` of the specified image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . SecurityOpt ,  "security-opt" ,  [ ] string { } ,  "security options (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . ShmSize ,  "shm-size" ,  defaultContainerConfig . Containers . ShmSize ,  "size of '/dev/shm'. The format is `<number><unit>`." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . Ulimit ,  "ulimit" ,  defaultContainerConfig . Containers . DefaultUlimits ,  "ulimit options" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 06:15:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVarP ( & flags . Volumes ,  "volume" ,  "v" ,  defaultContainerConfig . Containers . Volumes ,  "bind mount a volume into the container" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Add in the usernamespace and namespaceflags
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags  :=  GetUserNSFlags ( usernsResults ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									namespaceFlags  :=  GetNameSpaceFlags ( namespaceResults ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . AddFlagSet ( & usernsFlags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . AddFlagSet ( & namespaceFlags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs ,  nil 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetFromAndBudFlagsCompletions returns the FlagCompletions for the from and bud flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetFromAndBudFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "arch" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "add-host" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "blob-cache" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cap-add" ]  =  commonComp . AutocompleteCapabilities 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cap-drop" ]  =  commonComp . AutocompleteCapabilities 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cgroup-parent" ]  =  commonComp . AutocompleteDefault  // FIXME: This would be a path right?!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-period" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-quota" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-shares" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpuset-cpus" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpuset-mems" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "decryption-key" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "device" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns-search" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns-option" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "isolation" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "memory" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "memory-swap" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "os" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "security-opt" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "shm-size" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "ulimit" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "volume" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "variant" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Add in the usernamespace and namespace flag completions
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									userNsComp  :=  GetUserNSFlagsCompletions ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  name ,  comp  :=  range  userNsComp  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flagCompletion [ name ]  =  comp 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									namespaceComp  :=  GetNameSpaceFlagsCompletions ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  name ,  comp  :=  range  namespaceComp  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flagCompletion [ name ]  =  comp 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// UseLayers returns true if BUILDAH_LAYERS is set to "1" or "true"
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// otherwise it returns false
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  UseLayers ( )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									layers  :=  os . Getenv ( "BUILDAH_LAYERS" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  strings . ToLower ( layers )  ==  "true"  ||  layers  ==  "1"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DefaultFormat returns the default image format
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultFormat ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									format  :=  os . Getenv ( "BUILDAH_FORMAT" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  format  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  format 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  define . OCI 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DefaultIsolation returns the default image format
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultIsolation ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									isolation  :=  os . Getenv ( "BUILDAH_ISOLATION" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  isolation  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  isolation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-16 00:21:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  unshare . IsRootless ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  "rootless" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  define . OCI 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-19 04:39:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// DefaultHistory returns the default add-history setting
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultHistory ( )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									history  :=  os . Getenv ( "BUILDAH_HISTORY" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  strings . ToLower ( history )  ==  "true"  ||  history  ==  "1"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  VerifyFlagsArgsOrder ( args  [ ] string )  error  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  _ ,  arg  :=  range  args  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  strings . HasPrefix ( arg ,  "-" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  errors . Errorf ( "No options (%s) can be specified after the image or container name" ,  arg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// aliasFlags is a function to handle backwards compatibility with old flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  AliasFlags ( f  * pflag . FlagSet ,  name  string )  pflag . NormalizedName  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  name  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  "net" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "network" 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									case  "override-arch" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "arch" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  "override-os" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "os" 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 00:43:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									case  "purge" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "rm" 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  pflag . NormalizedName ( name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}