summaryrefslogtreecommitdiff
path: root/man/machinectl.1
blob: ffc0658c1b85cc6319eefbd17a10c1e432724ae0 (plain)
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
'\" t
.TH "MACHINECTL" "1" "" "systemd 221" "machinectl"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
machinectl \- Control the systemd machine manager
.SH "SYNOPSIS"
.HP \w'\fBmachinectl\fR\ 'u
\fBmachinectl\fR [OPTIONS...] {COMMAND} [NAME...]
.SH "DESCRIPTION"
.PP
\fBmachinectl\fR
may be used to introspect and control the state of the
\fBsystemd\fR(1)
virtual machine and container registration manager
\fBsystemd-machined.service\fR(8)\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-p\fR, \fB\-\-property=\fR
.RS 4
When showing machine or image properties, limit the output to certain properties as specified by the argument\&. If not specified, all set properties are shown\&. The argument should be a property name, such as
"Name"\&. If specified more than once, all properties with the specified names are shown\&.
.RE
.PP
\fB\-a\fR, \fB\-\-all\fR
.RS 4
When showing machine or image properties, show all properties regardless of whether they are set or not\&.
.sp
When listing VM or container images, do not suppress images beginning in a dot character ("\&.")\&.
.RE
.PP
\fB\-l\fR, \fB\-\-full\fR
.RS 4
Do not ellipsize process tree entries\&.
.RE
.PP
\fB\-\-no\-ask\-password\fR
.RS 4
Do not query the user for authentication for privileged operations\&.
.RE
.PP
\fB\-\-kill\-who=\fR
.RS 4
When used with
\fBkill\fR, choose which processes to kill\&. Must be one of
\fBleader\fR, or
\fBall\fR
to select whether to kill only the leader process of the machine or all processes of the machine\&. If omitted, defaults to
\fBall\fR\&.
.RE
.PP
\fB\-s\fR, \fB\-\-signal=\fR
.RS 4
When used with
\fBkill\fR, choose which signal to send to selected processes\&. Must be one of the well\-known signal specifiers, such as
\fBSIGTERM\fR,
\fBSIGINT\fR
or
\fBSIGSTOP\fR\&. If omitted, defaults to
\fBSIGTERM\fR\&.
.RE
.PP
\fB\-\-mkdir\fR
.RS 4
When used with
\fBbind\fR
creates the destination directory before applying the bind mount\&.
.RE
.PP
\fB\-\-read\-only\fR
.RS 4
When used with
\fBbind\fR
applies a read\-only bind mount\&.
.RE
.PP
\fB\-n\fR, \fB\-\-lines=\fR
.RS 4
When used with
\fBstatus\fR, controls the number of journal lines to show, counting from the most recent ones\&. Takes a positive integer argument\&. Defaults to 10\&.
.RE
.PP
\fB\-o\fR, \fB\-\-output=\fR
.RS 4
When used with
\fBstatus\fR, controls the formatting of the journal entries that are shown\&. For the available choices, see
\fBjournalctl\fR(1)\&. Defaults to
"short"\&.
.RE
.PP
\fB\-\-verify=\fR
.RS 4
When downloading a container or VM image, specify whether the image shall be verified before it is made available\&. Takes one of
"no",
"checksum"
and
"signature"\&. If
"no"
no verification is done\&. If
"checksum"
is specified the download is checked for integrity after transfer is complete, but no signatures are verified\&. If
"signature"
is specified, the checksum is verified and the images\*(Aqs signature is checked against a local keyring of trustable vendors\&. It is strongly recommended to set this option to
"signature"
if the server and protocol support this\&. Defaults to
"signature"\&.
.RE
.PP
\fB\-\-force\fR
.RS 4
When downloading a container or VM image, and a local copy by the specified local machine name already exists, delete it first and replace it by the newly downloaded image\&.
.RE
.PP
\fB\-\-dkr\-index\-url\fR
.RS 4
Specifies the index server to use for downloading
"dkr"
images with the
\fBpull\-dkr\fR\&. Takes a
"http://",
"https://"
URL\&.
.RE
.PP
\fB\-\-format=\fR
.RS 4
When used with the
\fBexport\-tar\fR
or
\fBexport\-raw\fR
commands specifies the compression format to use for the resulting file\&. Takes one of
"uncompressed",
"xz",
"gzip",
"bzip2"\&. By default the format is determined automatically from the image file name passed\&.
.RE
.PP
\fB\-H\fR, \fB\-\-host=\fR
.RS 4
Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
"@", to connect to\&. The hostname may optionally be suffixed by a container name, separated by
":", which connects directly to a specific container on the specified host\&. This will use SSH to talk to the remote machine manager instance\&. Container names may be enumerated with
\fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&.
.RE
.PP
\fB\-M\fR, \fB\-\-machine=\fR
.RS 4
Execute operation on a local container\&. Specify a container name to connect to\&.
.RE
.PP
\fB\-\-no\-pager\fR
.RS 4
Do not pipe output into a pager\&.
.RE
.PP
\fB\-\-no\-legend\fR
.RS 4
Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.SH "COMMANDS"
.PP
The following commands are understood:
.SS "Machine Commands"
.PP
\fBlist\fR
.RS 4
List currently running (online) virtual machines and containers\&. To enumerate container images that can be started, use
\fBlist\-images\fR
(see below)\&.
.RE
.PP
\fBstatus\fR \fINAME\fR\&.\&.\&.
.RS 4
Show terse runtime status information about one or more virtual machines and containers, followed by the most recent log data from the journal\&. This function is intended to generate human\-readable output\&. If you are looking for computer\-parsable output, use
\fBshow\fR
instead\&. Note that the log data shown is reported by the virtual machine or container manager, and frequently contains console output of the machine, but not necessarily journal contents of the machine itself\&.
.RE
.PP
\fBshow\fR \fINAME\fR\&.\&.\&.
.RS 4
Show properties of one or more registered virtual machines or containers or the manager itself\&. If no argument is specified, properties of the manager will be shown\&. If an NAME is specified, properties of this virtual machine or container are shown\&. By default, empty properties are suppressed\&. Use
\fB\-\-all\fR
to show those too\&. To select specific properties to show, use
\fB\-\-property=\fR\&. This command is intended to be used whenever computer\-parsable output is required\&. Use
\fBstatus\fR
if you are looking for formatted human\-readable output\&.
.RE
.PP
\fBstart\fR \fINAME\fR\&.\&.\&.
.RS 4
Start a container as a system service, using
\fBsystemd-nspawn\fR(1)\&. This starts
systemd\-nspawn@\&.service, instantiated for the specified machine name, similar to the effect of
\fBsystemctl start\fR
on the service name\&.
\fBsystemd\-nspawn\fR
looks for a container image by the specified name in
/var/lib/machines/
(and other search paths, see below) and runs it\&. Use
\fBlist\-images\fR
(see below), for listing available container images to start\&.
.sp
Note that
\fBsystemd-machined.service\fR(8)
also interfaces with a variety of other container and VM managers,
\fBsystemd\-nspawn\fR
is just one implementation of it\&. Most of the commands available in
\fBmachinectl\fR
may be used on containers or VMs controlled by other managers, not just
\fBsystemd\-nspawn\fR\&. Starting VMs and container images on those managers requires manager\-specific tools\&.
.sp
To interactively start a container on the command line with full access to the container\*(Aqs console, please invoke
\fBsystemd\-nspawn\fR
directly\&. To stop a running container use
\fBmachinectl poweroff\fR, see below\&.
.RE
.PP
\fBlogin\fR \fINAME\fR
.RS 4
Open an interactive terminal login session to a container\&. This will create a TTY connection to a specific container and asks for the execution of a getty on it\&. Note that this is only supported for containers running
\fBsystemd\fR(1)
as init system\&.
.sp
This command will open a full login prompt on the container, which then asks for username and password\&. Use
\fBsystemd-run\fR(1)
with the
\fB\-\-machine=\fR
switch to invoke a single command, either interactively or in the background within a local container\&.
.RE
.PP
\fBenable\fR \fINAME\fR\&.\&.\&., \fBdisable\fR \fINAME\fR\&.\&.\&.
.RS 4
Enable or disable a container as a system service to start at system boot, using
\fBsystemd-nspawn\fR(1)\&. This enables or disables
systemd\-nspawn@\&.service, instantiated for the specified machine name, similar to the effect of
\fBsystemctl enable\fR
or
\fBsystemctl disable\fR
on the service name\&.
.RE
.PP
\fBpoweroff\fR \fINAME\fR\&.\&.\&.
.RS 4
Power off one or more containers\&. This will trigger a reboot by sending SIGRTMIN+4 to the container\*(Aqs init process, which causes systemd\-compatible init systems to shut down cleanly\&. This operation does not work on containers that do not run a
\fBsystemd\fR(1)\-compatible init system, such as sysvinit\&. Use
\fBterminate\fR
(see below) to immediately terminate a container or VM, without cleanly shutting it down\&.
.RE
.PP
\fBreboot\fR \fINAME\fR\&.\&.\&.
.RS 4
Reboot one or more containers\&. This will trigger a reboot by sending SIGINT to the container\*(Aqs init process, which is roughly equivalent to pressing Ctrl+Alt+Del on a non\-containerized system, and is compatible with containers running any system manager\&.
.RE
.PP
\fBterminate\fR \fINAME\fR\&.\&.\&.
.RS 4
Immediately terminates a virtual machine or container, without cleanly shutting it down\&. This kills all processes of the virtual machine or container and deallocates all resources attached to that instance\&. Use
\fBpoweroff\fR
to issue a clean shutdown request\&.
.RE
.PP
\fBkill\fR \fINAME\fR\&.\&.\&.
.RS 4
Send a signal to one or more processes of the virtual machine or container\&. This means processes as seen by the host, not the processes inside the virtual machine or container\&. Use
\fB\-\-kill\-who=\fR
to select which process to kill\&. Use
\fB\-\-signal=\fR
to select the signal to send\&.
.RE
.PP
\fBbind\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR]
.RS 4
Bind mounts a directory from the host into the specified container\&. The first directory argument is the source directory on the host, the second directory argument the source directory on the host\&. When the latter is omitted the destination path in the container is the same as the source path on the host\&. When combined with the
\fB\-\-read\-only\fR
switch a ready\-only bind mount is created\&. When combined with the
\fB\-\-mkdir\fR
switch the destination path is first created before the mount is applied\&. Note that this option is currently only supported for
\fBsystemd-nspawn\fR(1)
containers\&.
.RE
.PP
\fBcopy\-to\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR]
.RS 4
Copies files or directories from the host system into a running container\&. Takes a container name, followed by the source path on the host and the destination path in the container\&. If the destination path is omitted the same as the source path is used\&.
.RE
.PP
\fBcopy\-from\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR]
.RS 4
Copies files or directories from a container into the host system\&. Takes a container name, followed by the source path in the container the destination path on the host\&. If the destination path is omitted the same as the source path is used\&.
.RE
.SS "Image Commands"
.PP
\fBlist\-images\fR
.RS 4
Show a list of locally installed container and VM images\&. This enumerates all raw disk images and container directories and subvolumes in
/var/lib/machines/
(and other search paths, see below)\&. Use
\fBstart\fR
(see above) to run a container off one of the listed images\&. Note that by default containers whose name begins with a dot ("\&.") are not shown\&. To show these too, specify
\fB\-\-all\fR\&. Note that a special image
"\&.host"
always implicitly exists and refers to the image the host itself is booted from\&.
.RE
.PP
\fBimage\-status\fR \fINAME\fR\&.\&.\&.
.RS 4
Show terse status information about one or more container or VM images\&. This function is intended to generate human\-readable output\&. Use
\fBshow\-image\fR
(see below) to generate computer\-parsable output instead\&.
.RE
.PP
\fBshow\-image\fR \fINAME\fR\&.\&.\&.
.RS 4
Show properties of one or more registered virtual machine or container images, or the manager itself\&. If no argument is specified, properties of the manager will be shown\&. If an NAME is specified, properties of this virtual machine or container image are shown\&. By default, empty properties are suppressed\&. Use
\fB\-\-all\fR
to show those too\&. To select specific properties to show, use
\fB\-\-property=\fR\&. This command is intended to be used whenever computer\-parsable output is required\&. Use
\fBimage\-status\fR
if you are looking for formatted human\-readable output\&.
.RE
.PP
\fBclone\fR \fINAME\fR \fINAME\fR
.RS 4
Clones a container or VM image\&. The arguments specify the name of the image to clone and the name of the newly cloned image\&. Note that plain directory container images are cloned into subvolume images with this command\&. Note that cloning a container or VM image is optimized for btrfs file systems, and might not be efficient on others, due to file system limitations\&.
.sp
Note that this command leaves host name, machine ID and all other settings that could identify the instance unmodified\&. The original image and the cloned copy will hence share these credentials, and it might be necessary to manually change them in the copy\&.
.RE
.PP
\fBrename\fR \fINAME\fR \fINAME\fR
.RS 4
Renames a container or VM image\&. The arguments specify the name of the image to rename and the new name of the image\&.
.RE
.PP
\fBread\-only\fR \fINAME\fR [\fIBOOL\fR]
.RS 4
Marks or (unmarks) a container or VM image read\-only\&. Takes a VM or container image name, followed by a boolean as arguments\&. If the boolean is omitted, positive is implied, i\&.e\&. the image is marked read\-only\&.
.RE
.PP
\fBremove\fR \fINAME\fR\&.\&.\&.
.RS 4
Removes one or more container or VM images\&. The special image
"\&.host", which refers to the host\*(Aqs own directory tree may not be removed\&.
.RE
.PP
\fBset\-limit\fR [\fINAME\fR] \fIBYTES\fR
.RS 4
Sets the maximum size in bytes a specific container or VM image, or all images may grow up to on disk (disk quota)\&. Takes either one or two parameters\&. The first, optional parameter refers to a container or VM image name\&. If specified the size limit of the specified image is changed\&. If omitted the overall size limit of the sum of all images stored locally is changed\&. The final argument specifies the size limit in bytes, possibly suffixed by the usual K, M, G, T units\&. If the size limit shall be disabled, specify
"\-"
as size\&.
.sp
Note that per\-container size limits are only supported on btrfs file systems\&. Also note that if
\fBset\-limit\fR
is invoked without image parameter, and
/var/lib/machines
is empty, and the directory is not located on btrfs, a btrfs loopback file is implicitly created as
/var/lib/machines\&.raw
with the given size, and mounted to
/var/lib/machines\&. The size of the loopback may later be readjusted with
\fBset\-limit\fR, as well\&. If such a loopback\-mounted
/var/lib/machines
directory is used
\fBset\-limit\fR
without image name alters both the quota setting within the file system as well as the loopback file and file system size itself\&.
.RE
.SS "Image Transfer Commands"
.PP
\fBpull\-tar\fR \fIURL\fR [\fINAME\fR]
.RS 4
Downloads a
\&.tar
container image from the specified URL, and makes it available under the specified local machine name\&. The URL must be of type
"http://"
or
"https://", and must refer to a
\&.tar,
\&.tar\&.gz,
\&.tar\&.xz
or
\&.tar\&.bz2
archive file\&. If the local machine name is omitted it is automatically derived from the last component of the URL, with its suffix removed\&.
.sp
The image is verified before it is made available, unless
\fB\-\-verify=no\fR
is specified\&. Verification is done via SHA256SUMS and SHA256SUMS\&.gpg files, that need to be made available on the same web server, under the same URL as the
\&.tar
file, but with the last component (the filename) of the URL replaced\&. With
\fB\-\-verify=checksum\fR
only the SHA256 checksum for the file is verified, based on the
SHA256SUMS
file\&. With
\fB\-\-verify=signature\fR
the SHA256SUMS file is first verified with detached GPG signature file
SHA256SUMS\&.gpg\&. The public key for this verification step needs to be available in
/usr/lib/systemd/import\-pubring\&.gpg
or
/etc/systemd/import\-pubring\&.gpg\&.
.sp
The container image will be downloaded and stored in a read\-only subvolume in
/var/lib/machines/, that is named after the specified URL and its HTTP etag\&. A writable snapshot is then taken from this subvolume, and named after the specified local name\&. This behaviour ensures that creating multiple container instances of the same URL is efficient, as multiple downloads are not necessary\&. In order to create only the read\-only image, and avoid creating its writable snapshot, specify
"\-"
as local machine name\&.
.sp
Note that the read\-only subvolume is prefixed with
\&.tar\-, and is thus not shown by
\fBlist\-images\fR, unless
\fB\-\-all\fR
is passed\&.
.sp
Note that pressing C\-c during execution of this command will not abort the download\&. Use
\fBcancel\-transfer\fR, described below\&.
.RE
.PP
\fBpull\-raw\fR \fIURL\fR [\fINAME\fR]
.RS 4
Downloads a
\&.raw
container or VM disk image from the specified URL, and makes it available under the specified local machine name\&. The URL must be of type
"http://"
or
"https://"\&. The container image must either be a
\&.qcow2
or raw disk image, optionally compressed as
\&.gz,
\&.xz, or
\&.bz2\&. If the local machine name is omitted it is automatically derived from the last component of the URL, with its suffix removed\&.
.sp
Image verification is identical for raw and tar images (see above)\&.
.sp
If the the downloaded image is in
\&.qcow2
format it is converted into a raw image file before it is made available\&.
.sp
Downloaded images of this type will be placed as read\-only
\&.raw
file in
/var/lib/machines/\&. A local, writable (reflinked) copy is then made under the specified local machine name\&. To omit creation of the local, writable copy pass
"\-"
as local machine name\&.
.sp
Similar to the behaviour of
\fBpull\-tar\fR, the read\-only image is prefixed with
\&.raw\-, and thus not shown by
\fBlist\-images\fR, unless
\fB\-\-all\fR
is passed\&.
.sp
Note that pressing C\-c during execution of this command will not abort the download\&. Use
\fBcancel\-transfer\fR, described below\&.
.RE
.PP
\fBpull\-dkr\fR \fIREMOTE\fR [\fINAME\fR]
.RS 4
Downloads a
"dkr"
container image and makes it available locally\&. The remote name refers to a
"dkr"
container name\&. If omitted, the local machine name is derived from the
"dkr"
container name\&.
.sp
Image verification is not available for
"dkr"
containers, and thus
\fB\-\-verify=no\fR
must always be specified with this command\&.
.sp
This command downloads all (missing) layers for the specified container and places them in read\-only subvolumes in
/var/lib/machines/\&. A writable snapshot of the newest layer is then created under the specified local machine name\&. To omit creation of this writable snapshot, pass
"\-"
as local machine name\&.
.sp
The read\-only layer subvolumes are prefixed with
\&.dkr\-, and thus not shown by
\fBlist\-images\fR, unless
\fB\-\-all\fR
is passed\&.
.sp
To specify the
"dkr"
index server to use for looking up the specified container, use
\fB\-\-dkr\-index\-url=\fR\&.
.sp
Note that pressing C\-c during execution of this command will not abort the download\&. Use
\fBcancel\-transfer\fR, described below\&.
.RE
.PP
\fBimport\-tar\fR \fIFILE\fR [\fINAME\fR], \fBimport\-raw\fR \fIFILE\fR [\fINAME\fR]
.RS 4
Imports a TAR or RAW container or VM image, and places it under the specified name in
/var/lib/machines/\&. When
\fBimport\-tar\fR
is used the file specified as first argument should be a tar archive, possibly compressed with xz, gzip or bzip2\&. It will then be unpacked into its own subvolume in
/var/lib/machines\&. When
\fBimport\-raw\fR
is used the file should be a qcow2 or raw disk image, possibly compressed with xz, gzip or bzip2\&. If the second argument (the resulting image name) is not specified it is automatically derived from the file name\&. If the file name is passed as
"\-"
the image is read from standard input, in which case the second argument is mandatory\&.
.sp
Similar as with
\fBpull\-tar\fR,
\fBpull\-raw\fR
the file system
/var/lib/machines\&.raw
is increased in size of necessary and appropriate\&. Optionally the
\fB\-\-read\-only\fR
switch may be used to create a read\-only container or VM image\&. No cryptographic validation is done when importing the images\&.
.sp
Much like image downloads, ongoing imports may be listed with
\fBlist\-transfers\fR
and aborted with
\fBcancel\-transfer\fR\&.
.RE
.PP
\fBexport\-tar\fR \fINAME\fR [\fIFILE\fR], \fBexport\-raw\fR \fINAME\fR [\fIFILE\fR]
.RS 4
Exports a TAR or RAW container or VM image and stores it in the specified file\&. The first parameter should be a VM or container image name\&. The second parameter should be a file path the TAR or RAW image is written to\&. If the path ends in
"\&.gz"
the file is compressed with gzip, if it ends in
"\&.xz"
with xz, and if it ends in
"\&.bz2"
with bzip2\&. If the path ends in neither the file is left uncompressed\&. If the second argument is missing the image is written to standard output\&. The compression may also be explicitly selected with the
\fB\-\-format=\fR
switch\&. This is in particular useful if the second parameter is left unspecified\&.
.sp
Much like image downloads and imports, ongoing exports may be listed with
\fBlist\-transfers\fR
and aborted with
\fBcancel\-transfer\fR\&.
.sp
Note that currently only directory and subvolume images may be exported as TAR images, and only raw disk images as RAW images\&.
.RE
.PP
\fBlist\-transfers\fR
.RS 4
Shows a list of container or VM image downloads, imports and exports that are currently in progress\&.
.RE
.PP
\fBcancel\-transfers\fR \fIID\fR\&.\&.\&.
.RS 4
Aborts a download, import or export of the container or VM image with the specified ID\&. To list ongoing transfers and their IDs, use
\fBlist\-transfers\fR\&.
.RE
.SH "FILES AND DIRECTORIES"
.PP
Machine images are preferably stored in
/var/lib/machines/, but are also searched for in
/usr/local/lib/machines/
and
/usr/lib/machines/\&. For compatibility reasons the directory
/var/lib/container/
is searched, too\&. Note that images stored below
/usr
are always considered read\-only\&. It is possible to symlink machines images from other directories into
/var/lib/machines/
to make them available for control with
\fBmachinectl\fR\&.
.PP
Note that many image operations are only supported, efficient or atomic on btrfs file systems\&. Due to this, if the
\fBpull\-tar\fR,
\fBpull\-raw\fR,
\fBpull\-dkr\fR,
\fBimport\-tar\fR,
\fBimport\-raw\fR
and
\fBset\-limit\fR
commands notice that
/var/lib/machines
is empty and not located on btrfs, they will implicitly set up a loopback file
/var/lib/machines\&.raw
containing a btrfs file system that is mounted to
/var/lib/machines\&. The size of this loopback file may be controlled dynamically with
\fBset\-limit\fR\&.
.PP
Disk images are understood by
\fBsystemd-nspawn\fR(1)
and
\fBmachinectl\fR
in three formats:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A simple directory tree, containing the files and directories of the container to boot\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A subvolume (on btrfs file systems), which are similar to the simple directories, described above\&. However, they have additional benefits, such as efficient cloning and quota reporting\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
"Raw" disk images, i\&.e\&. binary images of disks with a GPT or MBR partition table\&. Images of this type are regular files with the suffix
"\&.raw"\&.
.RE
.PP
See
\fBsystemd-nspawn\fR(1)
for more information on image formats, in particular it\*(Aqs
\fB\-\-directory=\fR
and
\fB\-\-image=\fR
options\&.
.SH "EXAMPLES"
.PP
\fBExample\ \&1.\ \&Download an Ubuntu image and open a shell in it\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# machinectl pull\-tar https://cloud\-images\&.ubuntu\&.com/trusty/current/trusty\-server\-cloudimg\-amd64\-root\&.tar\&.gz
# systemd\-nspawn \-M trusty\-server\-cloudimg\-amd64\-root
.fi
.if n \{\
.RE
.\}
.PP
This downloads and verifies the specified
\&.tar
image, and then uses
\fBsystemd-nspawn\fR(1)
to open a shell in it\&.
.PP
\fBExample\ \&2.\ \&Download a Fedora image, set a root password in it, start it as service\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# machinectl pull\-raw \-\-verify=no http://ftp\&.halifax\&.rwth\-aachen\&.de/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora\-Cloud\-Base\-20141203\-21\&.x86_64\&.raw\&.xz
# systemd\-nspawn \-M Fedora\-Cloud\-Base\-20141203\-21
# passwd
# exit
# machinectl start Fedora\-Cloud\-Base\-20141203\-21
# machinectl login Fedora\-Cloud\-Base\-20141203\-21
.fi
.if n \{\
.RE
.\}
.PP
This downloads the specified
\&.raw
image with verification disabled\&. Then a shell is opened in it and a root password is set\&. Afterwards the shell is left, and the machine started as system service\&. With the last command a login prompt into the container is requested\&.
.PP
\fBExample\ \&3.\ \&Download a Fedora "dkr" image\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# machinectl pull\-dkr \-\-verify=no mattdm/fedora
# systemd\-nspawn \-M fedora
.fi
.if n \{\
.RE
.\}
.PP
Downloads a
"dkr"
image and opens a shell in it\&. Note that the specified download command might require an index server to be specified with the
"\-\-dkr\-index\-url="\&.
.PP
\fBExample\ \&4.\ \&Exports a container image as tar file\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# machinectl export\-tar fedora myfedora\&.tar\&.xz
.fi
.if n \{\
.RE
.\}
.PP
Exports the container
"fedora"
in an xz\-compress tar file
myfedora\&.tar\&.xz
in the current directory\&.
.SH "EXIT STATUS"
.PP
On success, 0 is returned, a non\-zero failure code otherwise\&.
.SH "ENVIRONMENT"
.PP
\fI$SYSTEMD_PAGER\fR
.RS 4
Pager to use when
\fB\-\-no\-pager\fR
is not given; overrides
\fI$PAGER\fR\&. Setting this to an empty string or the value
"cat"
is equivalent to passing
\fB\-\-no\-pager\fR\&.
.RE
.PP
\fI$SYSTEMD_LESS\fR
.RS 4
Override the default options passed to
\fBless\fR
("FRSXMK")\&.
.RE
.SH "SEE ALSO"
.PP
\fBsystemd-machined.service\fR(8),
\fBsystemd-nspawn\fR(1),
\fBsystemd.special\fR(7),
\fBtar\fR(1),
\fBxz\fR(1),
\fBgzip\fR(1),
\fBbzip2\fR(1)