forked from containers/crun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crun.1
924 lines (732 loc) · 20.9 KB
/
crun.1
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
.nh
.TH crun 1 "User Commands"
.SH NAME
.PP
crun - a fast and lightweight OCI runtime
.SH SYNOPSIS
.PP
crun [global options] command [command options] [arguments...]
.SH DESCRIPTION
.PP
crun is a command line program for running Linux containers that
follow the Open Container Initiative (OCI) format.
.SH COMMANDS
.PP
\fBcreate\fP
Create a container. The runtime detaches from the container process
once the container environment is created. It is necessary to
successively use \fB\fCstart\fR for starting the container.
.PP
\fBdelete\fP
Remove definition for a container.
.PP
\fBexec\fP
Exec a command in a running container.
.PP
\fBlist\fP
List known containers.
.PP
\fBkill\fP
Send the specified signal to the container init process. If no signal
is specified, SIGTERM is used.
.PP
\fBps\fP
Show the processes running in a container.
.PP
\fBrun\fP
Create and immediately start a container.
.PP
\fBspec\fP
Generate a configuration file.
.PP
\fBstart\fP
Start a container that was previously created. A container cannot be
started multiple times.
.PP
\fBstate\fP
Output the state of a container.
.PP
\fBpause\fP
Pause all the processes in the container.
.PP
\fBresume\fP
Resume the processes in the container.
.PP
\fBupdate\fP
Update container resource constraints.
.PP
\fBcheckpoint\fP
Checkpoint a running container using CRIU
.PP
\fBrestore\fP
Restore a container from a checkpoint
.SH STATE
.PP
By default, when running as root user, crun saves its state under the
\fB/run/crun\fP directory. As unprivileged user, instead the
\fIXDG_RUNTIME_DIR\fP environment variable is honored, and the directory
\fB$XDG_RUNTIME_DIR/crun\fP is used. The global option \fB--root\fP
overrides this setting.
.SH GLOBAL OPTIONS
.PP
\fB--debug\fP
Produce verbose output.
.PP
\fB--log\fP=\fILOG-DESTINATION\fP
Define the destination for the error and warning messages generated by
crun.
If the error happens late in the container init process, when crun
already stopped watching it, then it will be printed to the container
stderr.
.PP
It is specified in the form \fIBACKEND:SPECIFIER\fP\&.
.PP
These following backends are supported:
.RS
.IP \(bu 2
file:PATH
.IP \(bu 2
journald:IDENTIFIER
.IP \(bu 2
syslog:IDENTIFIER
.RE
.PP
If no backend is specified, then \fIfile:\fP is used by default.
.PP
\fB--log-format\fP=\fIFORMAT\fP
Define the format of the log messages. It can either be \fBtext\fP, or
\fBjson\fP\&. The default is \fBtext\fP\&.
.PP
\fB--no-pivot\fP
Use \fB\fCchroot(2)\fR instead of \fB\fCpivot_root(2)\fR when creating the container.
This option is not safe, and should be avoided.
.PP
\fB--root\fP=\fIDIR\fP
Defines where to store the state for crun containers.
.PP
\fB--systemd-cgroup\fP
Use systemd for configuring cgroups. If not specified, the cgroup is
created directly using the cgroupfs backend.
.PP
\fB--cgroup-manager\fP=\fIMANAGER\fP
Specify what cgroup manager must be used. Permitted values are \fBcgroupfs\fP,
\fBsystemd\fP and \fBdisabled\fP\&.
.PP
\fB-?\fP, \fB--help\fP
Print a help list.
.PP
\fB--usage\fP
Print a short usage message.
.PP
\fB-V\fP, \fB--version\fP
Print program version
.SH CREATE OPTIONS
.PP
crun [global options] create [options] CONTAINER
.PP
\fB--bundle\fP=\fIPATH\fP
Path to the OCI bundle, by default it is the current directory.
.PP
\fB--config\fP=\fIFILE\fP
Override the configuration file to use. The default value is \fBconfig.json\fP\&.
.PP
\fB--console-socket\fP=\fISOCKET\fP
Path to a UNIX socket that will receive the ptmx end of the tty for
the container.
.PP
\fB--no-new-keyring\fP
Keep the same session key
.PP
\fB--preserve-fds\fP=\fIN\fP
Additional number of FDs to pass into the container.
.PP
\fB--pid-file\fP=\fIPATH\fP
Path to the file that will contain the container process PID.
.SH RUN OPTIONS
.PP
crun [global options] run [options] CONTAINER
.PP
\fB--bundle\fP=\fIBUNDLE\fP
Path to the OCI bundle, by default it is the current directory.
.PP
\fB--config\fP=\fIFILE\fP
Override the configuration file to use. The default value is \fBconfig.json\fP\&.
.PP
\fB--console-socket\fP=\fISOCKET\fP
Path to a UNIX socket that will receive the ptmx end of the tty for
the container.
.PP
\fB--no-new-keyring\fP
Keep the same session key.
.PP
\fB--preserve-fds\fP=\fIN\fP
Additional number of FDs to pass into the container.
.PP
\fB--pid-file\fP=\fIPATH\fP
Path to the file that will contain the container process PID.
.PP
\fB--detach\fP
Detach the container process from the current session.
.SH DELETE OPTIONS
.PP
crun [global options] delete [options] CONTAINER
.PP
\fB--force\fP
Delete the container even if it is still running.
.PP
\fB--regex\fP=\fIREGEX\fP
Delete all the containers that satisfy the specified regex.
.SH EXEC OPTIONS
.PP
crun [global options] exec [options] CONTAINER CMD
.PP
\fB--apparmor\fP=\fIPROFILE\fP
Set the apparmor profile for the process.
.PP
\fB--console-socket\fP=\fISOCKET\fP
Path to a UNIX socket that will receive the ptmx end of the tty for
the container.
.PP
\fB--cwd\fP=\fIPATH\fP
Set the working directory for the process to PATH.
.PP
\fB--cap\fP=\fICAP\fP
Specify an additional capability to add to the process.
.PP
\fB--detach\fP
Detach the container process from the current session.
.PP
\fB--cgroup\fP=\fIPATH\fP
Specify a sub-cgroup path inside the container cgroup. The path must
already exist in the container cgroup.
.PP
\fB--env\fP=\fIENV\fP
Specify an environment variable.
.PP
\fB--no-new-privs\fP
Set the no new privileges value for the process.
.PP
\fB--preserve-fds\fP=\fIN\fP
Additional number of FDs to pass into the container.
.PP
\fB--process\fP=\fIFILE\fP
Path to a file containing the process JSON configuration.
.PP
\fB--process-label\fP=\fIVALUE\fP
Set the asm process label for the process commonly used with selinux.
.PP
\fB--pid-file\fP=\fIPATH\fP
Path to the file that will contain the new process PID.
.PP
\fB-t\fP \fB--tty\fP
Allocate a pseudo TTY.
.PP
**-u \fIUSERSPEC\fP \fB--user\fP=\fIUSERSPEC\fP
Specify the user in the form UID[:GID].
.SH LIST OPTIONS
.PP
crun [global options] list [options]
.PP
\fB-q\fP \fB--quiet\fP
Show only the container ID.
.SH KILL OPTIONS
.PP
crun [global options] kill [options] CONTAINER SIGNAL
.PP
\fB--all\fP
Kill all the processes in the container.
.PP
\fB--regex\fP=\fIREGEX\fP
Kill all the containers that satisfy the specified regex.
.SH PS OPTIONS
.PP
crun [global options] ps [options]
.PP
\fB--format\fP=\fIFORMAT\fP
Specify the output format. It must be either \fB\fCtable\fR or \fB\fCjson\fR\&.
By default \fB\fCtable\fR is used.
.SH SPEC OPTIONS
.PP
crun [global options] spec [options]
.PP
\fB-b\fP \fIDIR\fP \fB--bundle\fP=\fIDIR\fP
Path to the root of the bundle dir (default ".").
.PP
\fB--rootless\fP
Generate a config.json file that is usable by an unprivileged user.
.SH UPDATE OPTIONS
.PP
crun [global options] update [options] CONTAINER
.PP
\fB--blkio-weight\fP=\fIVALUE\fP
Specifies per cgroup weight.
.PP
\fB--cpu-period\fP=\fIVALUE\fP
CPU CFS period to be used for hardcapping.
.PP
\fB--cpu-quota\fP=\fIVALUE\fP
CPU CFS hardcap limit.
.PP
\fB--cpu-rt-period\fP=\fIVALUE\fP
CPU realtime period to be used for hardcapping.
.PP
\fB--cpu-rt-runtime\fP=\fIVALUE\fP
CPU realtime hardcap limit.
.PP
\fB--cpu-share\fP=\fIVALUE\fP
CPU shares.
.PP
\fB--cpuset-cpus\fP=\fIVALUE\fP
CPU(s) to use.
.PP
\fB--cpuset-mems\fP=\fIVALUE\fP
Memory node(s) to use.
.PP
\fB--kernel-memory\fP=\fIVALUE\fP
Kernel memory limit.
.PP
\fB--kernel-memory-tcp\fP=\fIVALUE\fP
Kernel memory limit for TCP buffer.
.PP
\fB--memory\fP=\fIVALUE\fP
Memory limit.
.PP
\fB--memory-reservation\fP=\fIVALUE\fP
Memory reservation or soft_limit.
.PP
\fB--memory-swap\fP=\fIVALUE\fP
Total memory usage.
.PP
\fB--pids-limit\fP=\fIVALUE\fP
Maximum number of pids allowed in the container.
.PP
\fB-r\fP, \fB--resources\fP=\fIFILE\fP
Path to the file containing the resources to update.
.SH CHECKPOINT OPTIONS
.PP
crun [global options] checkpoint [options] CONTAINER
.PP
\fB--image-path\fP=\fIDIR\fP
Path for saving CRIU image files
.PP
\fB--work-path\fP=\fIDIR\fP
Path for saving work files and logs
.PP
\fB--leave-running\fP
Leave the process running after checkpointing
.PP
\fB--tcp-established\fP
Allow open TCP connections
.PP
\fB--ext-unix-sk\fP
Allow external UNIX sockets
.PP
\fB--shell-job\fP
Allow shell jobs
.PP
\fB--pre-dump\fP
Only checkpoint the container's memory without stopping the container.
It is not possible to restore a container from a pre-dump. A pre-dump
always needs a final checkpoint (without \fB--pre-dump\fP). It is possible
to make as many pre-dumps as necessary. For a second pre-dump or for
a final checkpoint it is necessary to use \fB--parent-path\fP to point
crun (and thus CRIU) to the pre-dump.
.PP
\fB--parent-path\fP=\fIDIR\fP
Doing multiple pre-dumps or the final checkpoint after one or multiple
pre-dumps requires that crun (and thus CRIU) knows the location of
the pre-dump. It is important to use a relative path from the actual
checkpoint directory specified via \fB--image-path\fP\&. It will fail
if an absolute path is used.
.PP
\fB--manage-cgroups-mode\fP=\fIMODE\fP
Specify which CRIU manage cgroup mode should be used. Permitted values are
\fBsoft\fP, \fBignore\fP, \fBfull\fP or \fBstrict\fP\&. Default is \fBsoft\fP\&.
.SH RESTORE OPTIONS
.PP
crun [global options] restore [options] CONTAINER
.PP
\fB-b DIR\fP \fB--bundle\fP=\fIDIR\fP
Container bundle directory (default ".")
.PP
\fB--image-path\fP=\fIDIR\fP
Path for saving CRIU image files
.PP
\fB--work-path\fP=\fIDIR\fP
Path for saving work files and logs
.PP
\fB--tcp-established\fP
Allow open TCP connections
.PP
\fB--ext-unix\fP
Allow external UNIX sockets
.PP
\fB--shell-job\fP
Allow shell jobs
.PP
\fB--detach\fP
Detach from the container's process
.PP
\fB--pid-file\fP=\fIFILE\fP
Where to write the PID of the container
.PP
\fB--manage-cgroups-mode\fP=\fIMODE\fP
Specify which CRIU manage cgroup mode should be used. Permitted values are
\fBsoft\fP, \fBignore\fP, \fBfull\fP or \fBstrict\fP\&. Default is \fBsoft\fP\&.
.SH Extensions to OCI
.SH \fB\fCrun.oci.mount_context_type=context\fR
.PP
Set the mount context type on volumes mounted with SELinux labels.
.PP
Valid context types are:
context (default)
fscontext
defcontext
rootcontext
.PP
More information on how the context mount flags works see the \fB\fCmount(8)\fR man page.
.SH \fB\fCrun.oci.seccomp.receiver=PATH\fR
.PP
If the annotation \fB\fCrun.oci.seccomp.receiver=PATH\fR is specified, the
seccomp listener is sent to the UNIX socket listening on the specified
path. It can also set with the \fB\fCRUN_OCI_SECCOMP_RECEIVER\fR environment variable.
It is an experimental feature, and the annotation will be removed once
it is supported in the OCI runtime specs. It must be an absolute path.
.SH \fB\fCrun.oci.seccomp.plugins=PATH\fR
.PP
If the annotation \fB\fCrun.oci.seccomp.plugins=PLUGIN1[:PLUGIN2]...\fR is specified, the
seccomp listener fd is handled through the specified plugins. The
plugin must either be an absolute path or a file name that is looked
up by \fB\fCdlopen(3)\fR\&. More information on how the lookup is performed
are available on the \fB\fCld.so(8)\fR man page.
.SH \fB\fCrun.oci.seccomp_fail_unknown_syscall=1\fR
.PP
If the annotation \fB\fCrun.oci.seccomp_fail_unknown_syscall\fR is present, then crun
will fail when an unknown syscall is encountered in the seccomp configuration.
.SH \fB\fCrun.oci.seccomp_bpf_data=PATH\fR
.PP
If the annotation \fB\fCrun.oci.seccomp_bpf_data\fR is present, then crun
ignores the seccomp section in the OCI configuration file and use the specified data
as the raw data to the \fB\fCseccomp(SECCOMP_SET_MODE_FILTER)\fR syscall.
The data must be encoded in base64.
.PP
It is an experimental feature, and the annotation will be removed once
it is supported in the OCI runtime specs.
.SH \fB\fCrun.oci.keep_original_groups=1\fR
.PP
If the annotation \fB\fCrun.oci.keep_original_groups\fR is present, then crun
will skip the \fB\fCsetgroups\fR syscall that is used to either set the
additional groups specified in the OCI configuration, or to reset the
list of additional groups if none is specified.
.SH \fB\fCrun.oci.pidfd_receiver=PATH\fR
.PP
It is an experimental feature and will be removed once the feature is in the
OCI runtime specs.
.PP
If present, specify the path to the UNIX socket that will receive the
pidfd for the container process.
.SH \fB\fCrun.oci.systemd.force_cgroup_v1=/PATH\fR
.PP
If the annotation \fB\fCrun.oci.systemd.force_cgroup_v1=/PATH\fR is present, then crun
will override the specified mount point \fB\fC/PATH\fR with a cgroup v1 mount
made of a single hierarchy \fB\fCnone,name=systemd\fR\&.
It is useful to run on a cgroup v2 system containers using older
versions of systemd that lack support for cgroup v2.
.PP
\fBNote\fP: Your container host has to have the cgroup v1 mount already present, otherwise
this will not work. If you want to run the container rootless, the user it runs under
has to have permissions to this mountpoint.
.PP
For example, as root:
.PP
.RS
.nf
mkdir /sys/fs/cgroup/systemd
mount cgroup -t cgroup /sys/fs/cgroup/systemd -o none,name=systemd,xattr
chown -R the_user.the_user /sys/fs/cgroup/systemd
.fi
.RE
.SH \fB\fCrun.oci.systemd.subgroup=SUBGROUP\fR
.PP
Override the name for the systemd sub cgroup created under the systemd
scope, so the final cgroup will be like:
.PP
.RS
.nf
/sys/fs/cgroup/$PATH/$SUBGROUP
.fi
.RE
.PP
When it is set to the empty string, a sub cgroup is not created.
.PP
If not specified, it defaults to \fB\fCcontainer\fR on cgroup v2, and to \fB\fC""\fR
on cgroup v1.
.PP
e.g.
.PP
.RS
.nf
/sys/fs/cgroup//system.slice/foo-352700.scope/container
.fi
.RE
.SH \fB\fCrun.oci.delegate-cgroup=DELEGATED-CGROUP\fR
.PP
If the \fB\fCrun.oci.systemd.subgroup\fR annotation is specified, yet another
sub-cgroup is created and the container process is moved here.
.PP
If a cgroup namespace is used, the cgroup namespace is created before
moving the container to the delegated cgroup.
.PP
.RS
.nf
/sys/fs/cgroup/$PATH/$SUBGROUP/$DELEGATED-CGROUP
.fi
.RE
.PP
The runtime doesn't apply any limit to the \fB\fC$DELEGATED-CGROUP\fR
sub-cgroup, the runtime uses only \fB\fC$PATH/$SUBGROUP\fR\&.
.PP
The container payload fully manages \fB\fC$DELEGATE-CGROUP\fR, the limits
applied to \fB\fC$PATH/$SUBGROUP\fR still applies to \fB\fC$DELEGATE-CGROUP\fR\&.
.PP
Since cgroup delegation is not safe on cgroup v1, this option is
supported only on cgroup v2.
.SH \fB\fCrun.oci.hooks.stdout=FILE\fR
.PP
If the annotation \fB\fCrun.oci.hooks.stdout\fR is present, then crun
will open the specified file and use it as the stdout for the hook
processes. The file is opened in append mode and it is created if it
doesn't already exist.
.SH \fB\fCrun.oci.hooks.stderr=FILE\fR
.PP
If the annotation \fB\fCrun.oci.hooks.stderr\fR is present, then crun
will open the specified file and use it as the stderr for the hook
processes. The file is opened in append mode and it is created if it
doesn't already exist.
.SH \fB\fCrun.oci.handler=HANDLER\fR
.PP
It is an experimental feature.
.PP
If specified, run the specified handler for execing the container.
The only supported values are \fB\fCkrun\fR and \fB\fCwasm\fR\&.
.RS
.IP \(bu 2
\fB\fCkrun\fR: When \fB\fCkrun\fR is specified, the \fB\fClibkrun.so\fR shared object is loaded
and it is used to launch the container using libkrun.
.IP \(bu 2
\fB\fCwasm\fR: If specified, run the wasm handler for container. Allows running wasm
workload natively. Accepts a \fB\fC\&.wasm\fR binary as input and if \fB\fC\&.wat\fR is
provided it will be automatically compiled into a wasm module. Stdout of
wasm module is relayed back via crun.
.RE
.SH tmpcopyup mount options
.PP
If the \fB\fCtmpcopyup\fR option is specified for a tmpfs, then the path that
is shadowed by the tmpfs mount is recursively copied up to the tmpfs
itself.
.SH r$FLAG mount options
.PP
If a \fB\fCr$FLAG\fR mount option is specified then the flag \fB\fC$FLAG\fR is set
recursively for each children mount.
.PP
These flags are supported:
.RS
.IP \(bu 2
"rro"
.IP \(bu 2
"rrw"
.IP \(bu 2
"rsuid"
.IP \(bu 2
"rnosuid"
.IP \(bu 2
"rdev"
.IP \(bu 2
"rnodev"
.IP \(bu 2
"rexec"
.IP \(bu 2
"rnoexec"
.IP \(bu 2
"rsync"
.IP \(bu 2
"rasync"
.IP \(bu 2
"rdirsync"
.IP \(bu 2
"rmand"
.IP \(bu 2
"rnomand"
.IP \(bu 2
"ratime"
.IP \(bu 2
"rnoatime"
.IP \(bu 2
"rdiratime"
.IP \(bu 2
"rnodiratime"
.IP \(bu 2
"rrelatime"
.IP \(bu 2
"rnorelatime"
.IP \(bu 2
"rstrictatime"
.IP \(bu 2
"rnostrictatime"
.RE
.SH idmap mount options
.PP
If the \fB\fCidmap\fR option is specified then the mount is ID mapped using
the container target user namespace. This is an experimental feature
and can change at any time without notice.
.PP
The \fB\fCidmap\fR option supports a custom mapping that can be different
than the user namespace used by the container.
.PP
The mapping can be specified after the \fB\fCidmap\fR option like:
\fB\fCidmap=uids=0-1-10#10-11-10;gids=0-100-10\fR\&.
.PP
For each triplet, the first value is the start of the backing
file system IDs that are mapped to the second value on the host. The
length of this mapping is given in the third value.
.PP
Multiple ranges are separated with \fB\fC#\fR\&.
.PP
These values are written to the \fB\fC/proc/$PID/uid_map\fR and
\fB\fC/proc/$PID/gid_map\fR files to create the user namespace for the
idmapped mount.
.PP
The only two options that are currently supported after \fB\fCidmap\fR are
\fB\fCuids\fR and \fB\fCgids\fR\&.
.PP
When a custom mapping is specified, a new user namespace is created
for the idmapped mount.
.PP
If no option is specified, then the container user namespace is used.
.PP
If the specified mapping is prepended with a '@' then the mapping is
considered relative to the container user namespace. The host ID for
the mapping is changed to account for the relative position of the
container user in the container user namespace.
.PP
For example, the mapping: \fB\fCuids=@1-3-10\fR, given a configuration like
.PP
.RS
.nf
"uidMappings": [
{
"containerID": 0,
"hostID": 0,
"size": 1
},
{
"containerID": 1,
"hostID": 2,
"size": 1000
}
]
.fi
.RE
.PP
will be converted to the absolute value \fB\fCuids=1-4-10\fR, where 4 is
calculated by adding 3 (container ID in the \fB\fCuids=\fR mapping) and 1
(\fB\fChostID - containerID\fR for the user namespace mapping where
\fB\fCcontainerID = 1\fR is found).
.PP
The current implementation doesn't take into account multiple
user namespace ranges, so it is the caller's responsibility to split a
mapping if it overlaps multiple ranges in the user namespace. In such
a case, there won't be any error reported.
.SH Automatically create user namespace
.PP
When running as user different than root, an user namespace is
automatically created even if it is not specified in the config file.
The current user is mapped to the ID 0 in the container, and any
additional id specified in the files \fB\fC/etc/subuid\fR and \fB\fC/etc/subgid\fR
is automatically added starting with ID 1.
.SH CGROUP v2
.PP
\fBNote\fP: cgroup v2 does not yet support control of realtime processes and
the cpu controller can only be enabled when all RT processes are in the root
cgroup. This will make crun fail while running alongside RT processes.
.PP
If the cgroup configuration found is for cgroup v1, crun attempts a
conversion when running on a cgroup v2 system.
.PP
These are the OCI resources currently supported with cgroup v2 and how
they are converted when needed from the cgroup v1 configuration.
.SH Memory controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
limit memory.max y = x
swap memory.swap.max y = x - memory_limit T{
the swap limit on cgroup v1 includes the memory usage too
T}
reservation memory.low y = x
.TE
.SH PIDs controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
limit pids.max y = x
.TE
.SH CPU controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
shares cpu.weight T{
y = (1 + ((x - 2) * 9999) / 262142)
T}
T{
convert from [2-262144] to [1-10000]
T}
period cpu.max y = x T{
period and quota are written together
T}
quota cpu.max y = x T{
period and quota are written together
T}
.TE
.SH blkio controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
weight io.bfq.weight y = x
weight_device io.bfq.weight y = x
weight io.weight (fallback) y = 1 + (x-10)*9999/990 T{
convert linearly from [10-1000] to [1-10000]
T}
weight_device io.weight (fallback) y = 1 + (x-10)*9999/990 T{
convert linearly from [10-1000] to [1-10000]
T}
rbps io.max y=x
wbps io.max y=x
riops io.max y=x
wiops io.max y=x
.TE
.SH cpuset controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
cpus cpuset.cpus y = x
mems cpuset.mems y = x
.TE
.SH hugetlb controller
.TS
allbox;
l l l l
l l l l .
\fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR
\&.limit_in_bytes hugetlb.\&.max y = x
.TE