1ctr(8)() ctr(8)()
2
3
4
5 ctr is an unsupported debug and administrative client for interacting
6 with the containerd daemon. Because it is unsupported, the commands,
7 options, and operations are not guaranteed to be backward compatible or
8 stable from release to release of the containerd project.
9
10
11
12
13
14
16 ctr
17
18
19
21 ctr
22
23
24 [--address|-a]=[value]
25 [--connect-timeout]=[value]
26 [--debug]
27 [--namespace|-n]=[value]
28 [--timeout]=[value]
29
30
31
32 Usage:
33
34
35 ctr [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
36
37
38
39
41 --address, -a="": address for containerd's GRPC server (default:
42 /run/containerd/containerd.sock)
43
44
45 --connect-timeout="": timeout for connecting to containerd (default:
46 0s)
47
48
49 --debug: enable debug output in logs
50
51
52 --namespace, -n="": namespace to use with commands (default: default)
53
54
55 --timeout="": total timeout for ctr commands (default: 0s)
56
57
58
61 provides information about containerd plugins
62
63
64 list, ls
65 lists containerd plugins
66
67
68 --detailed, -d: print detailed information about each plugin
69
70
71 --quiet, -q: print only the plugin ids
72
73
75 print the client and server versions
76
77
79 manage containers
80
81
82 create
83 create container
84
85
86 --allow-new-privs: turn off OCI spec's NoNewPrivileges feature flag
87
88
89 --config, -c="": path to the runtime-specific spec config file
90
91
92 --cpu-period="": Limit CPU CFS period (default: 0)
93
94
95 --cpu-quota="": Limit CPU CFS quota (default: -1)
96
97
98 --cwd="": specify the working directory of the process
99
100
101 --device="": add a device to a container
102
103
104 --env="": specify additional container environment variables (i.e.
105 FOO=bar)
106
107
108 --env-file="": specify additional container environment variables in a
109 file(i.e. FOO=bar, one per line)
110
111
112 --gpus="": add gpus to the container (default: 0)
113
114
115 --label="": specify additional labels (i.e. foo=bar)
116
117
118 --memory-limit="": memory limit (in bytes) for the container (default:
119 0)
120
121
122 --mount="": specify additional container mount (ex:
123 type=bind,src=/tmp,dst=/host,options=rbind:ro)
124
125
126 --net-host: enable host networking for the container
127
128
129 --no-pivot: disable use of pivot-root (linux only)
130
131
132 --pid-file="": file path to write the task's pid
133
134
135 --privileged: run privileged container
136
137
138 --read-only: set the containers filesystem as readonly
139
140
141 --rootfs: use custom rootfs that is not managed by containerd snapshot‐
142 ter
143
144
145 --runtime="": runtime name (default: io.containerd.runc.v2)
146
147
148 --seccomp: enable the default seccomp profile
149
150
151 --snapshotter="": snapshotter name. Empty value stands for the default
152 value.
153
154
155 --tty, -t: allocate a TTY for the container
156
157
158 --with-ns="": specify existing Linux namespaces to join at container
159 runtime (format ':')
160
161
162 delete, del, rm
163 delete one or more existing containers
164
165
166 --keep-snapshot: do not clean up snapshot with container
167
168
169 info
170 get info about a container
171
172
173 --spec: only display the spec
174
175
176 list, ls
177 list containers
178
179
180 --quiet, -q: print only the container id
181
182
183 label
184 set and clear labels for a container
185
186
187 checkpoint
188 checkpoint a container
189
190
191 --image: include the image in the checkpoint
192
193
194 --rw: include the rw layer in the checkpoint
195
196
197 --task: checkpoint container task
198
199
200 restore
201 restore a container from checkpoint
202
203
204 --live: restore the runtime and memory data from the checkpoint
205
206
207 --rw: restore the rw layer from the checkpoint
208
209
211 manage content
212
213
214 active
215 display active transfers
216
217
218 --root="": path to content store root (default: /tmp/content)
219
220
221 --timeout, -t="": total timeout for fetch (default: 0s)
222
223
224 delete, del, remove, rm
225 permanently delete one or more blobs
226
227
228 edit
229 edit a blob and return a new digest
230
231
232 --editor="": select editor (vim, emacs, etc.)
233
234
235 --validate="": validate the result against a format (json, mediatype,
236 etc.)
237
238
239 fetch
240 fetch all content for an image into containerd
241
242
243 --all-metadata: Pull metadata for all platforms
244
245
246 --all-platforms: pull content from all platforms
247
248
249 --hosts-dir="": Custom hosts configuration directory
250
251
252 --label="": labels to attach to the image
253
254
255 --metadata-only: Pull all metadata including manifests and configs
256
257
258 --plain-http: allow connections using plain HTTP
259
260
261 --platform="": Pull content from a specific platform
262
263
264 --refresh="": refresh token for authorization server
265
266
267 --skip-verify, -k: skip SSL certificate validation
268
269
270 --tlscacert="": path to TLS root CA
271
272
273 --tlscert="": path to TLS client certificate
274
275
276 --tlskey="": path to TLS client key
277
278
279 --user, -u="": user[:password] Registry user and password
280
281
282 fetch-object
283 retrieve objects from a remote
284
285
286 --hosts-dir="": Custom hosts configuration directory
287
288
289 --plain-http: allow connections using plain HTTP
290
291
292 --refresh="": refresh token for authorization server
293
294
295 --skip-verify, -k: skip SSL certificate validation
296
297
298 --tlscacert="": path to TLS root CA
299
300
301 --tlscert="": path to TLS client certificate
302
303
304 --tlskey="": path to TLS client key
305
306
307 --user, -u="": user[:password] Registry user and password
308
309
310 get
311 get the data for an object
312
313
314 ingest
315 accept content into the store
316
317
318 --expected-digest="": verify content against expected digest
319
320
321 --expected-size="": validate against provided size (default: 0)
322
323
324 list, ls
325 list all blobs in the store
326
327
328 --quiet, -q: print only the blob digest
329
330
331 push-object
332 push an object to a remote
333
334
335 --hosts-dir="": Custom hosts configuration directory
336
337
338 --plain-http: allow connections using plain HTTP
339
340
341 --refresh="": refresh token for authorization server
342
343
344 --skip-verify, -k: skip SSL certificate validation
345
346
347 --tlscacert="": path to TLS root CA
348
349
350 --tlscert="": path to TLS client certificate
351
352
353 --tlskey="": path to TLS client key
354
355
356 --user, -u="": user[:password] Registry user and password
357
358
359 label
360 add labels to content
361
362
364 display containerd events
365
366
368 manage images
369
370
371 check
372 check that an image has all content available locally
373
374
375 --snapshotter="": snapshotter name. Empty value stands for the default
376 value.
377
378
379 export
380 export images
381
382
383 --all-platforms: exports content from all platforms
384
385
386 --platform="": Pull content from a specific platform
387
388
389 --skip-manifest-json: do not add Docker compatible manifest.json to ar‐
390 chive
391
392
393 import
394 import images
395
396
397 --all-platforms: imports content for all platforms, false by default
398
399
400 --base-name="": base image name for added images, when provided only
401 images with this name prefix are imported
402
403
404 --compress-blobs: compress uncompressed blobs when creating manifest
405 (Docker format only)
406
407
408 --digests: whether to create digest images (default: false)
409
410
411 --index-name="": image name to keep index as, by default index is dis‐
412 carded
413
414
415 --no-unpack: skip unpacking the images, false by default
416
417
418 --snapshotter="": snapshotter name. Empty value stands for the default
419 value.
420
421
422 list, ls
423 list images known to containerd
424
425
426 --quiet, -q: print only the image refs
427
428
429 mount
430 mount an image to a target path
431
432
433 --hosts-dir="": Custom hosts configuration directory
434
435
436 --label="": labels to attach to the image
437
438
439 --plain-http: allow connections using plain HTTP
440
441
442 --platform="": Mount the image for the specified platform (default:
443 linux/amd64)
444
445
446 --refresh="": refresh token for authorization server
447
448
449 --rw: Enable write support on the mount
450
451
452 --skip-verify, -k: skip SSL certificate validation
453
454
455 --snapshotter="": snapshotter name. Empty value stands for the default
456 value.
457
458
459 --tlscacert="": path to TLS root CA
460
461
462 --tlscert="": path to TLS client certificate
463
464
465 --tlskey="": path to TLS client key
466
467
468 --user, -u="": user[:password] Registry user and password
469
470
471 unmount
472 unmount the image from the target
473
474
475 --hosts-dir="": Custom hosts configuration directory
476
477
478 --label="": labels to attach to the image
479
480
481 --plain-http: allow connections using plain HTTP
482
483
484 --refresh="": refresh token for authorization server
485
486
487 --rm: remove the snapshot after a successful unmount
488
489
490 --skip-verify, -k: skip SSL certificate validation
491
492
493 --snapshotter="": snapshotter name. Empty value stands for the default
494 value.
495
496
497 --tlscacert="": path to TLS root CA
498
499
500 --tlscert="": path to TLS client certificate
501
502
503 --tlskey="": path to TLS client key
504
505
506 --user, -u="": user[:password] Registry user and password
507
508
509 pull
510 pull an image from a remote
511
512
513 --all-metadata: Pull metadata for all platforms
514
515
516 --all-platforms: pull content and metadata from all platforms
517
518
519 --hosts-dir="": Custom hosts configuration directory
520
521
522 --label="": labels to attach to the image
523
524
525 --plain-http: allow connections using plain HTTP
526
527
528 --platform="": Pull content from a specific platform
529
530
531 --refresh="": refresh token for authorization server
532
533
534 --skip-verify, -k: skip SSL certificate validation
535
536
537 --snapshotter="": snapshotter name. Empty value stands for the default
538 value.
539
540
541 --tlscacert="": path to TLS root CA
542
543
544 --tlscert="": path to TLS client certificate
545
546
547 --tlskey="": path to TLS client key
548
549
550 --user, -u="": user[:password] Registry user and password
551
552
553 push
554 push an image to a remote
555
556
557 --hosts-dir="": Custom hosts configuration directory
558
559
560 --manifest="": digest of manifest
561
562
563 --manifest-type="": media type of manifest digest (default: applica‐
564 tion/vnd.oci.image.manifest.v1+json)
565
566
567 --plain-http: allow connections using plain HTTP
568
569
570 --platform="": push content from a specific platform
571
572
573 --refresh="": refresh token for authorization server
574
575
576 --skip-verify, -k: skip SSL certificate validation
577
578
579 --tlscacert="": path to TLS root CA
580
581
582 --tlscert="": path to TLS client certificate
583
584
585 --tlskey="": path to TLS client key
586
587
588 --user, -u="": user[:password] Registry user and password
589
590
591 remove, rm
592 remove one or more images by reference
593
594
595 --sync: Synchronously remove image and all associated resources
596
597
598 tag
599 tag an image
600
601
602 --force: force target_ref to be created, regardless if it already
603 exists
604
605
606 label
607 set and clear labels for an image
608
609
610 --replace-all, -r: replace all labels
611
612
614 manage leases
615
616
617 list, ls
618 list all active leases
619
620
621 --quiet, -q: print only the blob digest
622
623
624 create
625 create lease
626
627
628 --expires, -x="": expiration of lease (0 value will not expire)
629 (default: 24h0m0s)
630
631
632 --id="": set the id for the lease, will be generated by default
633
634
635 delete, rm
636 delete a lease
637
638
639 --sync: Synchronously remove leases and all unreferenced resources
640
641
643 manage namespaces
644
645
646 create, c
647 create a new namespace
648
649
650 list, ls
651 list namespaces
652
653
654 --quiet, -q: print only the namespace name
655
656
657 remove, rm
658 remove one or more namespaces
659
660
661 --cgroup, -c: delete the namespace's cgroup
662
663
664 label
665 set and clear labels for a namespace
666
667
669 provide golang pprof outputs for containerd
670
671
672 --debug-socket, -d="": socket path for containerd's debug server
673 (default: /run/containerd/debug.sock)
674
675
676 block
677 goroutine blocking profile
678
679
680 goroutines
681 dump goroutine stack dump
682
683
684 heap
685 dump heap profile
686
687
688 profile
689 CPU profile
690
691
692 --seconds, -s="": duration for collection (seconds) (default: 30s)
693
694
695 threadcreate
696 goroutine thread creating profile
697
698
699 trace
700 collect execution trace
701
702
703 --seconds, -s="": trace time (seconds) (default: 5s)
704
705
707 run a container
708
709
710 --allow-new-privs: turn off OCI spec's NoNewPrivileges feature flag
711
712
713 --cgroup="": cgroup path (To disable use of cgroup, set to "" explic‐
714 itly)
715
716
717 --config, -c="": path to the runtime-specific spec config file
718
719
720 --cpu-period="": Limit CPU CFS period (default: 0)
721
722
723 --cpu-quota="": Limit CPU CFS quota (default: -1)
724
725
726 --cpus="": set the CFS cpu qouta (default: 0.000000)
727
728
729 --cwd="": specify the working directory of the process
730
731
732 --detach, -d: detach from the task after it has started execution
733
734
735 --device="": add a device to a container
736
737
738 --env="": specify additional container environment variables (i.e.
739 FOO=bar)
740
741
742 --env-file="": specify additional container environment variables in a
743 file(i.e. FOO=bar, one per line)
744
745
746 --fifo-dir="": directory used for storing IO FIFOs
747
748
749 --gidmap="": run inside a user namespace with the specified GID mapping
750 range; specified with the format container-gid:host-gid:length
751
752
753 --gpus="": add gpus to the container (default: 0)
754
755
756 --label="": specify additional labels (i.e. foo=bar)
757
758
759 --log-uri="": log uri
760
761
762 --memory-limit="": memory limit (in bytes) for the container (default:
763 0)
764
765
766 --mount="": specify additional container mount (ex:
767 type=bind,src=/tmp,dst=/host,options=rbind:ro)
768
769
770 --net-host: enable host networking for the container
771
772
773 --no-pivot: disable use of pivot-root (linux only)
774
775
776 --null-io: send all IO to /dev/null
777
778
779 --pid-file="": file path to write the task's pid
780
781
782 --platform="": run image for specific platform
783
784
785 --privileged: run privileged container
786
787
788 --read-only: set the containers filesystem as readonly
789
790
791 --remap-labels: provide the user namespace ID remapping to the snap‐
792 shotter via label options; requires snapshotter support
793
794
795 --rm: remove the container after running
796
797
798 --rootfs: use custom rootfs that is not managed by containerd snapshot‐
799 ter
800
801
802 --runc-binary="": specify runc-compatible binary
803
804
805 --runc-systemd-cgroup: start runc with systemd cgroup manager
806
807
808 --runtime="": runtime name (default: io.containerd.runc.v2)
809
810
811 --seccomp: enable the default seccomp profile
812
813
814 --snapshotter="": snapshotter name. Empty value stands for the default
815 value.
816
817
818 --tty, -t: allocate a TTY for the container
819
820
821 --uidmap="": run inside a user namespace with the specified UID mapping
822 range; specified with the format container-uid:host-uid:length
823
824
825 --with-ns="": specify existing Linux namespaces to join at container
826 runtime (format ':')
827
828
830 manage snapshots
831
832
833 --snapshotter="": snapshotter name. Empty value stands for the default
834 value.
835
836
837 commit
838 commit an active snapshot into the provided name
839
840
841 diff
842 get the diff of two snapshots. the default second snapshot is the first
843 snapshot's parent.
844
845
846 --keep: keep diff content. up to creator to delete it.
847
848
849 --label="": labels to attach to the image
850
851
852 --media-type="": media type to use for creating diff (default: applica‐
853 tion/vnd.oci.image.layer.v1.tar+gzip)
854
855
856 --ref="": content upload reference to use
857
858
859 info
860 get info about a snapshot
861
862
863 list, ls
864 list snapshots
865
866
867 mounts, m, mount
868 mount gets mount commands for the snapshots
869
870
871 prepare
872 prepare a snapshot from a committed snapshot
873
874
875 --target, -t="": mount target path, will print mount, if provided
876
877
878 remove, rm
879 remove snapshots
880
881
882 label
883 add labels to content
884
885
886 tree
887 display tree view of snapshot branches
888
889
890 unpack
891 unpack applies layers from a manifest to a snapshot
892
893
894 --snapshotter="": snapshotter name. Empty value stands for the default
895 value.
896
897
898 usage
899 usage snapshots
900
901
902 -b: display size in bytes
903
904
905 view
906 create a read-only snapshot from a committed snapshot
907
908
909 --target, -t="": mount target path, will print mount, if provided
910
911
913 manage tasks
914
915
916 attach
917 attach to the IO of a running container
918
919
920 checkpoint
921 checkpoint a container
922
923
924 --exit: stop the container after the checkpoint
925
926
927 --image-path="": path to criu image files
928
929
930 --work-path="": path to criu work files and logs
931
932
933 delete, rm
934 delete one or more tasks
935
936
937 --exec-id="": process ID to kill
938
939
940 --force, -f: force delete task process
941
942
943 exec
944 execute additional processes in an existing container
945
946
947 --cwd="": working directory of the new process
948
949
950 --detach, -d: detach from the task after it has started execution
951
952
953 --exec-id="": exec specific id for the process
954
955
956 --fifo-dir="": directory used for storing IO FIFOs
957
958
959 --log-uri="": log uri for custom shim logging
960
961
962 --tty, -t: allocate a TTY for the container
963
964
965 list, ls
966 list tasks
967
968
969 --quiet, -q: print only the task id
970
971
972 kill
973 signal a container (default: SIGTERM)
974
975
976 --all, -a: send signal to all processes inside the container
977
978
979 --exec-id="": process ID to kill
980
981
982 --signal, -s="": signal to send to the container
983
984
985 pause
986 pause an existing container
987
988
989 ps
990 list processes for container
991
992
993 resume
994 resume a paused container
995
996
997 start
998 start a container that has been created
999
1000
1001 --detach, -d: detach from the task after it has started execution
1002
1003
1004 --fifo-dir="": directory used for storing IO FIFOs
1005
1006
1007 --log-uri="": log uri
1008
1009
1010 --null-io: send all IO to /dev/null
1011
1012
1013 --pid-file="": file path to write the task's pid
1014
1015
1016 metrics, metric
1017 get a single data point of metrics for a task with the built-in Linux
1018 runtime
1019
1020
1021 --format="": "table" or "json" (default: table)
1022
1023
1025 install a new package
1026
1027
1028 --libs, -l: install libs from the image
1029
1030
1031 --path="": set an optional install path other than the managed opt
1032 directory
1033
1034
1035 --replace, -r: replace any binaries or libs in the opt directory
1036
1037
1039 OCI tools
1040
1041
1042 spec
1043 see the output of the default OCI spec
1044
1045
1047 interact with a shim directly
1048
1049
1050 --id="": container id
1051
1052
1053 delete
1054 delete a container with a task
1055
1056
1057 exec
1058 exec a new process in the task's container
1059
1060
1061 --attach, -a: stay attached to the container and open the fifos
1062
1063
1064 --cwd="": current working directory
1065
1066
1067 --env, -e="": add environment vars
1068
1069
1070 --spec="": runtime spec
1071
1072
1073 --stderr="": specify the path to the stderr fifo
1074
1075
1076 --stdin="": specify the path to the stdin fifo
1077
1078
1079 --stdout="": specify the path to the stdout fifo
1080
1081
1082 --tty, -t: enable tty support
1083
1084
1085 start
1086 start a container with a task
1087
1088
1089 state
1090 get the state of all the processes of the task
1091
1092
1093
1094 ctr(8)()