-
Notifications
You must be signed in to change notification settings - Fork 124
/
action_flags.go
948 lines (863 loc) · 30.2 KB
/
action_flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
// Copyright (c) Contributors to the Apptainer project, established as
// Apptainer a Series of LF Projects LLC.
// For website terms of use, trademark policy, privacy policy and other
// project policies see https://lfprojects.org/policies
// Copyright (c) 2018-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
package cli
import (
"os"
"github.com/apptainer/apptainer/pkg/cmdline"
)
// actionflags.go contains flag variables for action-like commands to draw from
var (
AppName string
BindPaths []string
Mounts []string
HomePath string
OverlayPath []string
ScratchPath []string
WorkdirPath string
PwdPath string
ShellPath string
Hostname string
Network string
NetworkArgs []string
DNS string
Security []string
CgroupsTOMLFile string
VMRAM string
VMCPU string
VMIP string
ContainLibsPath []string
FuseMount []string
ApptainerEnv map[string]string
ApptainerEnvFile string
NoMount []string
DMTCPLaunch string
DMTCPRestart string
IsBoot bool
IsFakeroot bool
IsCleanEnv bool
IsCompat bool
IsContained bool
IsContainAll bool
IsWritable bool
IsWritableTmpfs bool
Nvidia bool
NvCCLI bool
Rocm bool
NoEval bool
NoHome bool
NoInit bool
NoNvidia bool
NoRocm bool
NoUmask bool
VM bool
VMErr bool
IsSyOS bool
disableCache bool
NetNamespace bool
UtsNamespace bool
UserNamespace bool
PidNamespace bool
IpcNamespace bool
AllowSUID bool
KeepPrivs bool
NoPrivs bool
AddCaps string
DropCaps string
BlkioWeight int
BlkioWeightDevice []string
CPUShares int
CPUs string // decimal
CPUSetCPUs string
CPUSetMems string
Memory string // bytes
MemoryReservation string // bytes
MemorySwap string // bytes
OomKillDisable bool
PidsLimit int
Unsquash bool
IgnoreSubuid bool
IgnoreFakerootCmd bool
IgnoreUserns bool
)
// --app
var actionAppFlag = cmdline.Flag{
ID: "actionAppFlag",
Value: &AppName,
DefaultValue: "",
Name: "app",
Usage: "set an application to run inside a container",
EnvKeys: []string{"APP", "APPNAME"},
}
// -B|--bind
var actionBindFlag = cmdline.Flag{
ID: "actionBindFlag",
Value: &BindPaths,
DefaultValue: cmdline.StringArray{}, // to allow commas in bind path
Name: "bind",
ShortHand: "B",
Usage: "a user-bind path specification. spec has the format src[:dest[:opts]], where src and dest are outside and inside paths. If dest is not given, it is set equal to src. Mount options ('opts') may be specified as 'ro' (read-only) or 'rw' (read/write, which is the default). Multiple bind paths can be given by a comma separated list.",
EnvKeys: []string{"BIND", "BINDPATH"},
Tag: "<spec>",
EnvHandler: cmdline.EnvAppendValue,
}
// --mount
var actionMountFlag = cmdline.Flag{
ID: "actionMountFlag",
Value: &Mounts,
DefaultValue: cmdline.StringArray{},
Name: "mount",
Usage: "a mount specification e.g. 'type=bind,source=/opt,destination=/hostopt'.",
EnvKeys: []string{"MOUNT"},
Tag: "<spec>",
EnvHandler: cmdline.EnvAppendValue,
}
// -H|--home
var actionHomeFlag = cmdline.Flag{
ID: "actionHomeFlag",
Value: &HomePath,
DefaultValue: CurrentUser.HomeDir,
Name: "home",
ShortHand: "H",
Usage: "a home directory specification. spec can either be a src path or src:dest pair. src is the source path of the home directory outside the container and dest overrides the home directory within the container.",
EnvKeys: []string{"HOME"},
Tag: "<spec>",
}
// -o|--overlay
var actionOverlayFlag = cmdline.Flag{
ID: "actionOverlayFlag",
Value: &OverlayPath,
DefaultValue: []string{},
Name: "overlay",
ShortHand: "o",
Usage: "use an overlayFS image for persistent data storage or as read-only layer of container",
EnvKeys: []string{"OVERLAY", "OVERLAYIMAGE"},
Tag: "<path>",
}
// -S|--scratch
var actionScratchFlag = cmdline.Flag{
ID: "actionScratchFlag",
Value: &ScratchPath,
DefaultValue: []string{},
Name: "scratch",
ShortHand: "S",
Usage: "include a scratch directory within the container that is linked to a temporary dir (use -W to force location)",
EnvKeys: []string{"SCRATCH", "SCRATCHDIR"},
Tag: "<path>",
}
// -W|--workdir
var actionWorkdirFlag = cmdline.Flag{
ID: "actionWorkdirFlag",
Value: &WorkdirPath,
DefaultValue: "",
Name: "workdir",
ShortHand: "W",
Usage: "working directory to be used for /tmp, /var/tmp and $HOME (if -c/--contain was also used)",
EnvKeys: []string{"WORKDIR"},
Tag: "<path>",
}
// --disable-cache
var actionDisableCacheFlag = cmdline.Flag{
ID: "actionDisableCacheFlag",
Value: &disableCache,
DefaultValue: false,
Name: "disable-cache",
Usage: "do not use or create cache",
EnvKeys: []string{"DISABLE_CACHE"},
}
// -s|--shell
var actionShellFlag = cmdline.Flag{
ID: "actionShellFlag",
Value: &ShellPath,
DefaultValue: "",
Name: "shell",
ShortHand: "s",
Usage: "path to program to use for interactive shell",
EnvKeys: []string{"SHELL"},
Tag: "<path>",
}
// --pwd
var actionPwdFlag = cmdline.Flag{
ID: "actionPwdFlag",
Value: &PwdPath,
DefaultValue: "",
Name: "pwd",
Usage: "initial working directory for payload process inside the container",
EnvKeys: []string{"PWD", "TARGET_PWD"},
Tag: "<path>",
}
// --hostname
var actionHostnameFlag = cmdline.Flag{
ID: "actionHostnameFlag",
Value: &Hostname,
DefaultValue: "",
Name: "hostname",
Usage: "set container hostname",
EnvKeys: []string{"HOSTNAME"},
Tag: "<name>",
}
// --network
var actionNetworkFlag = cmdline.Flag{
ID: "actionNetworkFlag",
Value: &Network,
DefaultValue: "",
Name: "network",
Usage: "specify desired network type separated by commas, each network will bring up a dedicated interface inside container",
EnvKeys: []string{"NETWORK"},
Tag: "<name>",
}
// --network-args
var actionNetworkArgsFlag = cmdline.Flag{
ID: "actionNetworkArgsFlag",
Value: &NetworkArgs,
DefaultValue: []string{},
Name: "network-args",
Usage: "specify network arguments to pass to CNI plugins",
EnvKeys: []string{"NETWORK_ARGS"},
Tag: "<args>",
}
// --dns
var actionDNSFlag = cmdline.Flag{
ID: "actionDnsFlag",
Value: &DNS,
DefaultValue: "",
Name: "dns",
Usage: "list of DNS server separated by commas to add in resolv.conf",
EnvKeys: []string{"DNS"},
}
// --security
var actionSecurityFlag = cmdline.Flag{
ID: "actionSecurityFlag",
Value: &Security,
DefaultValue: []string{},
Name: "security",
Usage: "enable security features (SELinux, Apparmor, Seccomp)",
EnvKeys: []string{"SECURITY"},
}
// --apply-cgroups
var actionApplyCgroupsFlag = cmdline.Flag{
ID: "actionApplyCgroupsFlag",
Value: &CgroupsTOMLFile,
DefaultValue: "",
Name: "apply-cgroups",
Usage: "apply cgroups from file for container processes (root only)",
EnvKeys: []string{"APPLY_CGROUPS"},
}
// --vm-ram
var actionVMRAMFlag = cmdline.Flag{
ID: "actionVMRAMFlag",
Value: &VMRAM,
DefaultValue: "1024",
Name: "vm-ram",
Usage: "amount of RAM in MiB to allocate to Virtual Machine (implies --vm)",
Tag: "<size>",
EnvKeys: []string{"VM_RAM"},
}
// --vm-cpu
var actionVMCPUFlag = cmdline.Flag{
ID: "actionVMCPUFlag",
Value: &VMCPU,
DefaultValue: "1",
Name: "vm-cpu",
Usage: "number of CPU cores to allocate to Virtual Machine (implies --vm)",
Tag: "<CPU #>",
EnvKeys: []string{"VM_CPU"},
}
// --vm-ip
var actionVMIPFlag = cmdline.Flag{
ID: "actionVMIPFlag",
Value: &VMIP,
DefaultValue: "dhcp",
Name: "vm-ip",
Usage: "IP Address to assign for container usage. Defaults to DHCP within bridge network.",
Tag: "<IP Address>",
EnvKeys: []string{"VM_IP"},
}
// hidden flag to handle APPTAINER_CONTAINLIBS environment variable
var actionContainLibsFlag = cmdline.Flag{
ID: "actionContainLibsFlag",
Value: &ContainLibsPath,
DefaultValue: []string{},
Name: "containlibs",
Hidden: true,
EnvKeys: []string{"CONTAINLIBS"},
}
// --fusemount
var actionFuseMountFlag = cmdline.Flag{
ID: "actionFuseMountFlag",
Value: &FuseMount,
DefaultValue: []string{},
Name: "fusemount",
Usage: "A FUSE filesystem mount specification of the form '<type>:<fuse command> <mountpoint>' - where <type> is 'container' or 'host', specifying where the mount will be performed ('container-daemon' or 'host-daemon' will run the FUSE process detached). <fuse command> is the path to the FUSE executable, plus options for the mount. <mountpoint> is the location in the container to which the FUSE mount will be attached. E.g. 'container:sshfs 10.0.0.1:/ /sshfs'. Implies --pid.",
EnvKeys: []string{"FUSESPEC"},
}
// hidden flag to handle APPTAINER_TMPDIR environment variable
var actionTmpDirFlag = cmdline.Flag{
ID: "actionTmpDirFlag",
Value: &tmpDir,
DefaultValue: os.TempDir(),
Name: "tmpdir",
Usage: "specify a temporary directory to use for build",
Hidden: true,
EnvKeys: []string{"TMPDIR"},
}
// --boot
var actionBootFlag = cmdline.Flag{
ID: "actionBootFlag",
Value: &IsBoot,
DefaultValue: false,
Name: "boot",
Usage: "execute /sbin/init to boot container (root only)",
EnvKeys: []string{"BOOT"},
}
// -f|--fakeroot
var actionFakerootFlag = cmdline.Flag{
ID: "actionFakerootFlag",
Value: &IsFakeroot,
DefaultValue: false,
Name: "fakeroot",
ShortHand: "f",
Usage: "run container with the appearance of running as root",
EnvKeys: []string{"FAKEROOT"},
}
// -e|--cleanenv
var actionCleanEnvFlag = cmdline.Flag{
ID: "actionCleanEnvFlag",
Value: &IsCleanEnv,
DefaultValue: false,
Name: "cleanenv",
ShortHand: "e",
Usage: "clean environment before running container",
EnvKeys: []string{"CLEANENV"},
}
// --compat
var actionCompatFlag = cmdline.Flag{
ID: "actionCompatFlag",
Value: &IsCompat,
DefaultValue: false,
Name: "compat",
Usage: "apply settings for increased OCI/Docker compatibility. Infers --containall, --no-init, --no-umask, --no-eval, --writable-tmpfs.",
EnvKeys: []string{"COMPAT"},
}
// -c|--contain
var actionContainFlag = cmdline.Flag{
ID: "actionContainFlag",
Value: &IsContained,
DefaultValue: false,
Name: "contain",
ShortHand: "c",
Usage: "use minimal /dev and empty other directories (e.g. /tmp and $HOME) instead of sharing filesystems from your host",
EnvKeys: []string{"CONTAIN"},
}
// -C|--containall
var actionContainAllFlag = cmdline.Flag{
ID: "actionContainAllFlag",
Value: &IsContainAll,
DefaultValue: false,
Name: "containall",
ShortHand: "C",
Usage: "contain not only file systems, but also PID, IPC, and environment",
EnvKeys: []string{"CONTAINALL"},
}
// --nv
var actionNvidiaFlag = cmdline.Flag{
ID: "actionNvidiaFlag",
Value: &Nvidia,
DefaultValue: false,
Name: "nv",
Usage: "enable Nvidia support",
EnvKeys: []string{"NV"},
}
// --nvccli
var actionNvCCLIFlag = cmdline.Flag{
ID: "actionNvCCLIFlag",
Value: &NvCCLI,
DefaultValue: false,
Name: "nvccli",
Usage: "use nvidia-container-cli for GPU setup (experimental)",
EnvKeys: []string{"NVCCLI"},
}
// --rocm flag to automatically bind
var actionRocmFlag = cmdline.Flag{
ID: "actionRocmFlag",
Value: &Rocm,
DefaultValue: false,
Name: "rocm",
Usage: "enable experimental Rocm support",
EnvKeys: []string{"ROCM"},
}
// -w|--writable
var actionWritableFlag = cmdline.Flag{
ID: "actionWritableFlag",
Value: &IsWritable,
DefaultValue: false,
Name: "writable",
ShortHand: "w",
Usage: "by default all Apptainer containers are available as read only. This option makes the file system accessible as read/write.",
EnvKeys: []string{"WRITABLE"},
}
// --writable-tmpfs
var actionWritableTmpfsFlag = cmdline.Flag{
ID: "actionWritableTmpfsFlag",
Value: &IsWritableTmpfs,
DefaultValue: false,
Name: "writable-tmpfs",
Usage: "makes the file system accessible as read-write with non persistent data (with overlay support only)",
EnvKeys: []string{"WRITABLE_TMPFS"},
}
// --no-home
var actionNoHomeFlag = cmdline.Flag{
ID: "actionNoHomeFlag",
Value: &NoHome,
DefaultValue: false,
Name: "no-home",
Usage: "do NOT mount users home directory if /home is not the current working directory",
EnvKeys: []string{"NO_HOME"},
}
// --no-mount
var actionNoMountFlag = cmdline.Flag{
ID: "actionNoMountFlag",
Value: &NoMount,
DefaultValue: []string{},
Name: "no-mount",
Usage: "disable one or more 'mount xxx' options set in apptainer.conf and/or specify absolute destination path to disable a 'bind path' entry",
EnvKeys: []string{"NO_MOUNT"},
}
// --no-init
var actionNoInitFlag = cmdline.Flag{
ID: "actionNoInitFlag",
Value: &NoInit,
DefaultValue: false,
Name: "no-init",
Usage: "do NOT start shim process with --pid",
EnvKeys: []string{"NOSHIMINIT"},
}
// hidden flag to disable nvidia bindings when 'always use nv = yes'
var actionNoNvidiaFlag = cmdline.Flag{
ID: "actionNoNvidiaFlag",
Value: &NoNvidia,
DefaultValue: false,
Name: "no-nv",
Hidden: true,
EnvKeys: []string{"NV_OFF", "NO_NV"},
}
// hidden flag to disable rocm bindings when 'always use rocm = yes'
var actionNoRocmFlag = cmdline.Flag{
ID: "actionNoRocmFlag",
Value: &NoRocm,
DefaultValue: false,
Name: "no-rocm",
Hidden: true,
EnvKeys: []string{"ROCM_OFF", "NO_ROCM"},
}
// --vm
var actionVMFlag = cmdline.Flag{
ID: "actionVMFlag",
Value: &VM,
DefaultValue: false,
Name: "vm",
Usage: "enable VM support",
EnvKeys: []string{"VM"},
}
// --vm-err
var actionVMErrFlag = cmdline.Flag{
ID: "actionVMErrFlag",
Value: &VMErr,
DefaultValue: false,
Name: "vm-err",
Usage: "enable attaching stderr from VM",
EnvKeys: []string{"VMERROR"},
}
// --syos
// TODO: Keep this in production?
var actionSyOSFlag = cmdline.Flag{
ID: "actionSyOSFlag",
Value: &IsSyOS,
DefaultValue: false,
Name: "syos",
Usage: "execute SyOS shell",
EnvKeys: []string{"SYOS"},
}
// -p|--pid
var actionPidNamespaceFlag = cmdline.Flag{
ID: "actionPidNamespaceFlag",
Value: &PidNamespace,
DefaultValue: false,
Name: "pid",
ShortHand: "p",
Usage: "run container in a new PID namespace",
EnvKeys: []string{"PID", "UNSHARE_PID"},
}
// -i|--ipc
var actionIpcNamespaceFlag = cmdline.Flag{
ID: "actionIpcNamespaceFlag",
Value: &IpcNamespace,
DefaultValue: false,
Name: "ipc",
ShortHand: "i",
Usage: "run container in a new IPC namespace",
EnvKeys: []string{"IPC", "UNSHARE_IPC"},
}
// -n|--net
var actionNetNamespaceFlag = cmdline.Flag{
ID: "actionNetNamespaceFlag",
Value: &NetNamespace,
DefaultValue: false,
Name: "net",
ShortHand: "n",
Usage: "run container in a new network namespace (sets up a bridge network interface by default)",
EnvKeys: []string{"NET", "UNSHARE_NET"},
}
// --uts
var actionUtsNamespaceFlag = cmdline.Flag{
ID: "actionUtsNamespaceFlag",
Value: &UtsNamespace,
DefaultValue: false,
Name: "uts",
Usage: "run container in a new UTS namespace",
EnvKeys: []string{"UTS", "UNSHARE_UTS"},
}
// -u|--userns
var actionUserNamespaceFlag = cmdline.Flag{
ID: "actionUserNamespaceFlag",
Value: &UserNamespace,
DefaultValue: false,
Name: "userns",
ShortHand: "u",
Usage: "run container in a new user namespace",
EnvKeys: []string{"USERNS", "UNSHARE_USERNS"},
}
// --keep-privs
var actionKeepPrivsFlag = cmdline.Flag{
ID: "actionKeepPrivsFlag",
Value: &KeepPrivs,
DefaultValue: false,
Name: "keep-privs",
Usage: "let root user keep privileges in container (root only)",
EnvKeys: []string{"KEEP_PRIVS"},
}
// --no-privs
var actionNoPrivsFlag = cmdline.Flag{
ID: "actionNoPrivsFlag",
Value: &NoPrivs,
DefaultValue: false,
Name: "no-privs",
Usage: "drop all privileges from root user in container)",
EnvKeys: []string{"NO_PRIVS"},
}
// --add-caps
var actionAddCapsFlag = cmdline.Flag{
ID: "actionAddCapsFlag",
Value: &AddCaps,
DefaultValue: "",
Name: "add-caps",
Usage: "a comma separated capability list to add",
EnvKeys: []string{"ADD_CAPS"},
}
// --drop-caps
var actionDropCapsFlag = cmdline.Flag{
ID: "actionDropCapsFlag",
Value: &DropCaps,
DefaultValue: "",
Name: "drop-caps",
Usage: "a comma separated capability list to drop",
EnvKeys: []string{"DROP_CAPS"},
}
// --allow-setuid
var actionAllowSetuidFlag = cmdline.Flag{
ID: "actionAllowSetuidFlag",
Value: &AllowSUID,
DefaultValue: false,
Name: "allow-setuid",
Usage: "allow setuid binaries in container (root only)",
EnvKeys: []string{"ALLOW_SETUID"},
}
// --env
var actionEnvFlag = cmdline.Flag{
ID: "actionEnvFlag",
Value: &ApptainerEnv,
DefaultValue: map[string]string{},
Name: "env",
Usage: "pass environment variable to contained process",
}
// --env-file
var actionEnvFileFlag = cmdline.Flag{
ID: "actionEnvFileFlag",
Value: &ApptainerEnvFile,
DefaultValue: "",
Name: "env-file",
Usage: "pass environment variables from file to contained process",
EnvKeys: []string{"ENV_FILE"},
}
// --no-umask
var actionNoUmaskFlag = cmdline.Flag{
ID: "actionNoUmask",
Value: &NoUmask,
DefaultValue: false,
Name: "no-umask",
Usage: "do not propagate umask to the container, set default 0022 umask",
EnvKeys: []string{"NO_UMASK"},
}
// --no-eval
var actionNoEvalFlag = cmdline.Flag{
ID: "actionNoEval",
Value: &NoEval,
DefaultValue: false,
Name: "no-eval",
Usage: "do not shell evaluate env vars or OCI container CMD/ENTRYPOINT/ARGS",
EnvKeys: []string{"NO_EVAL"},
}
// --dmtcp-launch
var actionDMTCPLaunchFlag = cmdline.Flag{
ID: "actionDMTCPLaunchFlag",
Value: &DMTCPLaunch,
DefaultValue: "",
Name: "dmtcp-launch",
Usage: "checkpoint for dmtcp to save container process state to (experimental)",
EnvKeys: []string{"DMTCP_LAUNCH"},
}
// --dmtcp-restart
var actionDMTCPRestartFlag = cmdline.Flag{
ID: "actionDMTCPrestartFlag",
Value: &DMTCPRestart,
DefaultValue: "",
Name: "dmtcp-restart",
Usage: "checkpoint for dmtcp to use to restart container process (experimental)",
EnvKeys: []string{"DMTCP_RESTART"},
}
// --blkio-weight
var actionBlkioWeightFlag = cmdline.Flag{
ID: "actionBlkioWeight",
Value: &BlkioWeight,
DefaultValue: 0,
Name: "blkio-weight",
Usage: "Block IO relative weight in range 10-1000, 0 to disable",
EnvKeys: []string{"BLKIO_WEIGHT"},
}
// --blkio-weight-device
var actionBlkioWeightDeviceFlag = cmdline.Flag{
ID: "actionBlkioWeightDevice",
Value: &BlkioWeightDevice,
DefaultValue: []string{},
Name: "blkio-weight-device",
Usage: "Device specific block IO relative weight",
EnvKeys: []string{"BLKIO_WEIGHT_DEVICE"},
}
// --cpu-shares
var actionCPUSharesFlag = cmdline.Flag{
ID: "actionCPUShares",
Value: &CPUShares,
DefaultValue: -1,
Name: "cpu-shares",
Usage: "CPU shares for container",
EnvKeys: []string{"CPU_SHARES"},
}
// --cpus
var actionCPUsFlag = cmdline.Flag{
ID: "actionCPUs",
Value: &CPUs,
DefaultValue: "",
Name: "cpus",
Usage: "Number of CPUs available to container",
EnvKeys: []string{"CPU_SHARES"},
}
// --cpuset-cpus
var actionCPUsetCPUsFlag = cmdline.Flag{
ID: "actionCPUsetCPUs",
Value: &CPUSetCPUs,
DefaultValue: "",
Name: "cpuset-cpus",
Usage: "List of host CPUs available to container",
EnvKeys: []string{"CPUSET_CPUS"},
}
// --cpuset-mems
var actionCPUsetMemsFlag = cmdline.Flag{
ID: "actionCPUsetMems",
Value: &CPUSetMems,
DefaultValue: "",
Name: "cpuset-mems",
Usage: "List of host memory nodes available to container",
EnvKeys: []string{"CPUSET_MEMS"},
}
// --memory
var actionMemoryFlag = cmdline.Flag{
ID: "actionMemory",
Value: &Memory,
DefaultValue: "",
Name: "memory",
Usage: "Memory limit in bytes",
EnvKeys: []string{"MEMORY"},
}
// --memory-reservation
var actionMemoryReservationFlag = cmdline.Flag{
ID: "actionMemoryReservation",
Value: &MemoryReservation,
DefaultValue: "",
Name: "memory-reservation",
Usage: "Memory soft limit in bytes",
EnvKeys: []string{"MEMORY_RESERVATION"},
}
// --memory-swap
var actionMemorySwapFlag = cmdline.Flag{
ID: "actionMemorySwap",
Value: &MemorySwap,
DefaultValue: "",
Name: "memory-swap",
Usage: "Swap limit, use -1 for unlimited swap",
EnvKeys: []string{"MEMORY_SWAP"},
}
// --oom-kill-disable
var actionOomKillDisableFlag = cmdline.Flag{
ID: "oomKillDisable",
Value: &OomKillDisable,
DefaultValue: false,
Name: "oom-kill-disable",
Usage: "Disable OOM killer",
EnvKeys: []string{"OOM_KILL_DISABLE"},
}
// --pids-limit
var actionPidsLimitFlag = cmdline.Flag{
ID: "actionPidsLimit",
Value: &PidsLimit,
DefaultValue: 0,
Name: "pids-limit",
Usage: "Limit number of container PIDs, use -1 for unlimited",
EnvKeys: []string{"PIDS_LIMIT"},
}
// --unsquash
var actionUnsquashFlag = cmdline.Flag{
ID: "actionUnsquashFlag",
Value: &Unsquash,
DefaultValue: false,
Name: "unsquash",
Usage: "Convert SIF file to temporary sandbox before running",
EnvKeys: []string{"UNSQUASH"},
}
// --ignore-subuid
var actionIgnoreSubuidFlag = cmdline.Flag{
ID: "actionIgnoreSubuidFlag",
Value: &IgnoreSubuid,
DefaultValue: false,
Name: "ignore-subuid",
Usage: "ignore entries inside /etc/subuid",
EnvKeys: []string{"IGNORE_SUBUID"},
Hidden: true,
}
// --ignore-fakeroot-command
var actionIgnoreFakerootCommand = cmdline.Flag{
ID: "actionIgnoreFakerootCommandFlag",
Value: &IgnoreFakerootCmd,
DefaultValue: false,
Name: "ignore-fakeroot-command",
Usage: "ignore fakeroot command",
EnvKeys: []string{"IGNORE_FAKEROOT_COMMAND"},
Hidden: true,
}
// --ignore-userns
var actionIgnoreUsernsFlag = cmdline.Flag{
ID: "actionIgnoreUsernsFlag",
Value: &IgnoreUserns,
DefaultValue: false,
Name: "ignore-userns",
Usage: "ignore user namespaces",
EnvKeys: []string{"IGNORE_USERNS"},
Hidden: true,
}
func init() {
addCmdInit(func(cmdManager *cmdline.CommandManager) {
cmdManager.RegisterCmd(ExecCmd)
cmdManager.RegisterCmd(ShellCmd)
cmdManager.RegisterCmd(RunCmd)
cmdManager.RegisterCmd(TestCmd)
cmdManager.SetCmdGroup("actions", ExecCmd, ShellCmd, RunCmd, TestCmd)
actionsCmd := cmdManager.GetCmdGroup("actions")
if instanceStartCmd != nil {
cmdManager.SetCmdGroup("actions_instance", ExecCmd, ShellCmd, RunCmd, TestCmd, instanceStartCmd)
cmdManager.RegisterFlagForCmd(&actionBootFlag, instanceStartCmd)
} else {
cmdManager.SetCmdGroup("actions_instance", actionsCmd...)
}
actionsInstanceCmd := cmdManager.GetCmdGroup("actions_instance")
cmdManager.RegisterFlagForCmd(&actionAddCapsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionAllowSetuidFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionAppFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionApplyCgroupsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionBindFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCleanEnvFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCompatFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionContainAllFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionContainFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionContainLibsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionDisableCacheFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionDNSFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionDropCapsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionFakerootFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionFuseMountFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionHomeFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionHostnameFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionIpcNamespaceFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionKeepPrivsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionMountFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNetNamespaceFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNetworkArgsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNetworkFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoHomeFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoMountFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoInitFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoNvidiaFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoRocmFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoPrivsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNvidiaFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNvCCLIFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionRocmFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionOverlayFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&commonPromptForPassphraseFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&commonPEMFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionPidNamespaceFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionPwdFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionScratchFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionSecurityFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionShellFlag, ShellCmd)
cmdManager.RegisterFlagForCmd(&actionSyOSFlag, ShellCmd)
cmdManager.RegisterFlagForCmd(&actionTmpDirFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionUserNamespaceFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionUtsNamespaceFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionVMCPUFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionVMErrFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionVMFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionVMIPFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionVMRAMFlag, actionsCmd...)
cmdManager.RegisterFlagForCmd(&actionWorkdirFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionWritableFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionWritableTmpfsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&commonNoHTTPSFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&commonOldNoHTTPSFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&dockerLoginFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&dockerPasswordFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&dockerUsernameFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionEnvFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionEnvFileFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoUmaskFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionNoEvalFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionBlkioWeightFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionBlkioWeightDeviceFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCPUSharesFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCPUsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCPUsetCPUsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionCPUsetMemsFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionMemoryFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionMemoryReservationFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionMemorySwapFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionOomKillDisableFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionPidsLimitFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionUnsquashFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionIgnoreSubuidFlag, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionIgnoreFakerootCommand, actionsInstanceCmd...)
cmdManager.RegisterFlagForCmd(&actionIgnoreUsernsFlag, actionsInstanceCmd...)
})
}